Topic Author
Posts: 193
Joined: 30 May 2014, 10:26

Implicit DataTemplates

07 Apr 2021, 23:57

I just tried to add DataTemplates for Views in a ResourceDIctionary like this:
<DataTemplate DataType="{x:Type vm:MyViewModel}">
	<v:MyView />
In WPF that works fine, yet Unity Noesis complains that I cannot add a DataTemplate to a ResourceDictionary without specifying a key.
This is an issue. Implicitly used DataTemplates are supposed to be used this way. Why do I need to specifiy a key? This is another inconsistency between WPF and Noesis
that gets in the way of the Blend + Noesis workflow.
User avatar
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: Implicit DataTemplates

09 Apr 2021, 13:10

I just created a view model like this:
namespace Testing
    public class MyViewModel { }
And use it in a xaml like this:
      <DataTemplate DataType="{x:Type local:MyViewModel}">
        <Rectangle Fill="Red"/>
    <ContentControl Content="{Binding}"/>
And it parses fine and works as expected when I set an instance of MyViewModel in the DataContext.

What version of NoesisGUI are you using? My tests are with latest 3.0.11 version.
Topic Author
Posts: 193
Joined: 30 May 2014, 10:26

Re: Implicit DataTemplates

10 Apr 2021, 17:56

I couldn't reproduce this for some reason. I'll report back if I run into it again. You can close this for now.
User avatar
Site Admin
Posts: 3914
Joined: 20 Jan 2012, 17:18

Re: Implicit DataTemplates

12 Apr 2021, 11:17

Please, open a bug report if you hit this again. Thanks

Who is online

Users browsing this forum: Google [Bot], hcpizzi and 0 guests