Why does my DataTemplate break the WPF designer?
- by PRINCESS FLUFF
Why does the DataTemplate line break the WPF designer in Visual Studio 2008?
The program compiles and runs properly. The DataTemplate is applied as it should. However the entire DataTemplate block of code is underlined in red, and when I simply "build" the program without running, I get the error "Type reference cannot find public type named 'Character'"
How come it can't find it in the designer yet the program applies the template properly?
<UserControl x:Class="WPF_Tests.Tests.TwoCollecViews.TwoViews"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:DetailsPane="clr-namespace:WPF_Tests.Tests.DetailsPane"
>
<UserControl.Resources>
<DataTemplate DataType="{x:Type DetailsPane:Character}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Name}"></TextBlock>
</StackPanel>
</DataTemplate>
</UserControl.Resources>
<Grid>
<ListBox ItemsSource="{Binding Path=Characters}" />
</Grid>
</UserControl>
EDIT: I am being told that this may be a bug in Visual Studio 2008, as it worked correctly in 2010. You can download the code here: http://www.mediafire.com/?z1myytvwm4n - The Test/TwoCollec xaml file's designer will break with this code.