May 11th, 2009 11:07 AM
#1
ResourceDictionary reference error
I created the following resource dictionary, but the reference to ItemFontStyle throws a reference error ("StaticResource reference 'ItemFontStyle' was not found") in the HierarchicalDataTemplate. Any suggestions?
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="ItemFontStyle">
<Setter Property="Control.Foreground" Value="Black" />
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Discontinued}" Value="True">
<Setter Property="Control.Foreground" Value="Gray" />
<Setter Property="Control.FontStyle" Value="Italic" />
</DataTrigger>
</Style.Triggers>
</Style>
<HierarchicalDataTemplate x:Key="ItemTemplate">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding Path=name}" Padding="2" Width="200"
Style="{StaticResource ItemFontStyle}" />
<TextBlock Grid.Column="1" Text="{Binding Path=UnitsInStock}" Padding="2"
Style="{StaticResource ItemFontStyle}" />
</Grid>
</HierarchicalDataTemplate>
</ResourceDictionary>
May 11th, 2009 11:25 AM
#2
Re: ResourceDictionary reference error
Please ignore this question - I'm even redder in my face - when the xaml was closed and then reopened ... the erro disappeared.
This is reminiscent of Windows 3.1 - close the window, open the window - ;-}
Thanks
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks