View Issue Details

IDProjectCategoryView StatusLast Update
0001985NoesisGUIUnitypublic2021-04-28 13:59
Reportereasylaser Assigned Tosfernandez  
PrioritynormalSeveritymajor 
Status resolvedResolutionreopened 
Product Version3.0.11 
Target Version3.0.12Fixed in Version3.0.12 
Summary0001985: noesis:Xaml.Dependencies are not working
Description

Hi,

None of the XAMLs added with noesis:Xaml.Dependencies are shown in the inspector.

For example:

<noesis:Xaml.Dependencies>
<noesis:Dependency Source="Assets/InirectRef.xaml"/>
</noesis:Xaml.Dependencies>

Steps To Reproduce

Create a new project and add Noesis 3.0.11

Put the attached files in the Assets folder.

Open Base.asset and check dependencies.

Attached Files
Base.cs (258 bytes)   
using Noesis;
using System;
using UnityEngine.Scripting;

[assembly: Preserve]

namespace NoesisTest
{
    public class Base : UserControl
    {
        public Base()
        {
            Noesis.GUI.LoadComponent(this, "Assets/Base.xaml");
        }
    }
}
Base.cs (258 bytes)   
BaseVM.cs (841 bytes)   
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace NoesisTest
{
    public class BaseVM
    {
        public ICommand Quit
        {
            get
            {
                return new QuitCommand();
            }
        }

        public object ViewFromCode
        {
            get
            {
                return new IndirectRef();
            }
        }
    }

    public class QuitCommand : ICommand
    {
        public event EventHandler CanExecuteChanged;

        public bool CanExecute(object parameter)
        {
            return true;
        }

        public void Execute(object parameter)
        {
            UnityEngine.Application.Quit();
        }
    }
}
BaseVM.cs (841 bytes)   
DirectRef.cs (208 bytes)   
using Noesis;

namespace NoesisTest
{
    public class DirectRef : UserControl
    {
        public DirectRef()
        {
            Noesis.GUI.LoadComponent(this, "Assets/DirectRef.xaml");
        }
    }
}
DirectRef.cs (208 bytes)   
IndirectRef.cs (214 bytes)   
using Noesis;

namespace NoesisTest
{
    public class IndirectRef : UserControl
    {
        public IndirectRef()
        {
            Noesis.GUI.LoadComponent(this, "Assets/IndirectRef.xaml");
        }
    }
}
IndirectRef.cs (214 bytes)   
Base.xaml (1,106 bytes)   
<UserControl
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:global="clr-namespace:NoesisTest"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
        xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
        xmlns:noesis="clr-namespace:NoesisGUIExtensions"
        mc:Ignorable="d"
        x:Class="NoesisTest.Base"
        x:Name="Root"
        d:DesignWidth="2048" d:DesignHeight="1536"
        >

  <UserControl.DataContext>
    <global:BaseVM />
  </UserControl.DataContext>

  <noesis:Xaml.Dependencies>
    <noesis:Dependency Source="Assets/InirectRef.xaml"/>
  </noesis:Xaml.Dependencies>

  <Stackpanel>
    <Button Content="Test" Width="200" Height="100" Command="{Binding Quit}" />
    <global:DirectRef />
    <ContentPresenter Content="{Binding ViewFromCode}" />
  </Stackpanel>
</UserControl>
Base.xaml (1,106 bytes)   
DirectRef.xaml (720 bytes)   
<UserControl
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:global="clr-namespace:NoesisTest"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
        xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
        mc:Ignorable="d"
        x:Class="NoesisTest.DirectRef"
        x:Name="Root"
        d:DesignWidth="2048" d:DesignHeight="1536"
        >

<Button Content="DirectRef" Width="200" Height="100" />

</UserControl>
DirectRef.xaml (720 bytes)   
IndirectRef.xaml (724 bytes)   
<UserControl
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:global="clr-namespace:NoesisTest"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
        xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
        mc:Ignorable="d"
        x:Class="NoesisTest.IndirectRef"
        x:Name="Root"
        d:DesignWidth="2048" d:DesignHeight="1536"
        >

<Button Content="IndirectRef" Width="200" Height="100" />

</UserControl>
IndirectRef.xaml (724 bytes)   
PlatformAny

Activities

sfernandez

sfernandez

2021-04-27 21:10

manager   ~0007173

Last edited: 2021-04-27 21:10

The dependency uri should be relative or absolute (starting with a '/'). In this example it should be:

  <noesis:Xaml.Dependencies>
<noesis:Dependency Source="IndirectRef.xaml"/>
</noesis:Xaml.Dependencies>

or:

  <noesis:Xaml.Dependencies>
<noesis:Dependency Source="/Assets/IndirectRef.xaml"/>
</noesis:Xaml.Dependencies>

I tried both and they work as expected.

easylaser

easylaser

2021-04-28 09:33

reporter   ~0007175

Sorry to bother.

I used the same Uri as in LoadComponent. I couldn't imagine that they should differ...

sfernandez

sfernandez

2021-04-28 10:15

manager   ~0007176

Don't worry, we improved the documentation of that extension to make it clear how to specify the URI.
Thanks.

jsantos

jsantos

2021-04-28 11:15

manager   ~0007179

I don't think fixing the documentation is enough. We should emit a warning or error in the console.

I am reopening this.

Issue History

Date Modified Username Field Change
2021-04-27 12:50 easylaser New Issue
2021-04-27 12:50 easylaser File Added: Base.cs
2021-04-27 12:50 easylaser File Added: BaseVM.cs
2021-04-27 12:50 easylaser File Added: DirectRef.cs
2021-04-27 12:50 easylaser File Added: IndirectRef.cs
2021-04-27 12:50 easylaser File Added: Base.xaml
2021-04-27 12:50 easylaser File Added: DirectRef.xaml
2021-04-27 12:50 easylaser File Added: IndirectRef.xaml
2021-04-27 15:20 easylaser Summary noesis:Xaml.Dependencies is not working => noesis:Xaml.Dependencies are not working
2021-04-27 15:20 easylaser Description Updated
2021-04-27 15:20 easylaser Steps to Reproduce Updated
2021-04-27 21:10 sfernandez Assigned To => sfernandez
2021-04-27 21:10 sfernandez Status new => feedback
2021-04-27 21:10 sfernandez Note Added: 0007173
2021-04-27 21:10 sfernandez Note Edited: 0007173
2021-04-28 09:33 easylaser Note Added: 0007175
2021-04-28 09:33 easylaser Status feedback => assigned
2021-04-28 10:15 sfernandez Status assigned => resolved
2021-04-28 10:15 sfernandez Resolution open => no change required
2021-04-28 10:15 sfernandez Fixed in Version => 3.0.12
2021-04-28 10:15 sfernandez Note Added: 0007176
2021-04-28 10:15 sfernandez Target Version => 3.0.12
2021-04-28 11:15 jsantos Note Added: 0007179
2021-04-28 11:16 jsantos Status resolved => feedback
2021-04-28 11:16 jsantos Resolution no change required => reopened
2021-04-28 11:16 jsantos Status feedback => assigned
2021-04-28 13:59 sfernandez Status assigned => resolved
2025-10-10 13:29 jsantos Category Unity3D => Unity