- KeldorKatarn
- Posts: 193
- Joined:
Implicit DataTemplates
I just tried to add DataTemplates for Views in a ResourceDIctionary like this:
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.
Code: Select all
<DataTemplate DataType="{x:Type vm:MyViewModel}">
<v:MyView />
</DataTemplate
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.
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: Implicit DataTemplates
I just created a view model like this:
And use it in a xaml like this:
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.
Code: Select all
namespace Testing
{
public class MyViewModel { }
}
Code: Select all
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Testing">
<Grid.Resources>
<DataTemplate DataType="{x:Type local:MyViewModel}">
<Rectangle Fill="Red"/>
</DataTemplate>
</Grid.Resources>
<ContentControl Content="{Binding}"/>
</Grid>
What version of NoesisGUI are you using? My tests are with latest 3.0.11 version.
- KeldorKatarn
- Posts: 193
- Joined:
Re: Implicit DataTemplates
I couldn't reproduce this for some reason. I'll report back if I run into it again. You can close this for now.
Re: Implicit DataTemplates
Please, open a bug report if you hit this again. Thanks
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 55 guests