CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: ResourceDictionary reference error

  1. #1
    Join Date
    May 2009

    Red face 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"

    <Style x:Key="ItemFontStyle">
    <Setter Property="Control.Foreground" Value="Black" />
    <DataTrigger Binding="{Binding Path=Discontinued}" Value="True">
    <Setter Property="Control.Foreground" Value="Gray" />
    <Setter Property="Control.FontStyle" Value="Italic" />

    <HierarchicalDataTemplate x:Key="ItemTemplate">
    <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}" />


  2. #2
    Join Date
    May 2009

    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 - ;-}


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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)