1

I got a ResourceDictionary CustomStyles.xaml and i've implemented it in two views. In the first view all templates and styles are working just fine. Though in the second view my Templates aren't applied to my DataGrid and when i enter the view the following output is shown. Still in my VS2012 Designer the HeaderTemplates are shown correct.

System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='TransparentWhiteBrush'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='TransparentWhiteBrush'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='GrayBrush7'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='Gray3'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='Gray3'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='ControlBackgroundBrush'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='TextBrush'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='GrayBrush7'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='TextBrush'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='TransparentWhiteBrush'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='TransparentWhiteBrush'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='GrayBrush7'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='Gray3'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='Gray3'

these Resources are not mine and i've not applied them in my view. My implemented Resources:

<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/Office2010/Silver.xaml" />
    <ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/Office2010/Silver.xaml" />
    <ResourceDictionary Source="/Fluent;Component/Themes/Metro/White.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
    <ResourceDictionary Source="/PQS;component/Resources/CustomStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>

and finally my Datatemplate:

<DataGrid ItemsSource="{Binding Items.View}" Style="{DynamicResource InputDataGridStyle}" Grid.Row="1" Name="InputGrid" Loaded="InputGrid_Loaded" KeyUp="InputGrid_OnKeyUp">
    <DataGrid.Columns>
        <DataGridTemplateColumn HeaderTemplate="{DynamicResource InputGridIndexHeaderTempalte}" CellTemplate="{DynamicResource InputGridIndexCellTempalte}" />

        <DataGridTemplateColumn HeaderTemplate="{DynamicResource InputGridTimeStampHeaderTemplate}" CellTemplate="{DynamicResource InputGridTimeStampCellTemplate}" />

        <DataGridTemplateColumn HeaderTemplate="{DynamicResource InputGridUserHeaderTemplate}" CellTemplate="{DynamicResource InputGridUserCellTemplate}" />

        <DataGridTemplateColumn HeaderTemplate="{DynamicResource InputGridValueHeaderTemplate}" CellTemplate="{DynamicResource InputGridValueCellTempalte}" Visibility="{Binding ElementName=InputGrid, Path=DataContext.CharacteristicMeasure.Characteristic.CharacteristicType.IsBool,Converter={StaticResource boolToInv}, ConverterParameter=true}" />

        <DataGridTemplateColumn HeaderTemplate="{DynamicResource InputGridValueHeaderTemplate}" CellTemplate="{DynamicResource InputGridBoolValueCellTempalte}" Visibility="{Binding ElementName=InputGrid, Path=DataContext.CharacteristicMeasure.Characteristic.CharacteristicType.IsBool,Converter={StaticResource boolToInv}}" />

        <DataGridTemplateColumn HeaderTemplate="{DynamicResource InputGridValidHeaderTemplate}" CellTemplate="{DynamicResource InputGridValidCellTemplate}" />

        <DataGridTemplateColumn HeaderTemplate="{DynamicResource InputGridTextHeaderTemplate}" CellTemplate="{DynamicResource InputGridTextCellTemplate}" />
    </DataGrid.Columns>
</DataGrid>

e.g. one header- and cell-template

<DataTemplate x:Key="InputGridIndexHeaderTempalte">
    <TextBlock Text="#" />
</DataTemplate>

<DataTemplate x:Key="InputGridIndexCellTempalte">
    <TextBlock Text="{Binding Index}" />
</DataTemplate>

screenshot of my designer enter image description here

and here how it looks at the application: enter image description here

please help!!! and ask if you need more information!

JuHwon
  • 2,033
  • 2
  • 34
  • 54
  • 1
    IN the first datagridTemplateColumn you misspelled the name of you data template. Where are you defining the resources dictionary in App.xaml? What does your CustomStyles.xaml look like? – jfin3204 Feb 25 '13 at 19:23
  • here is my CustomStyles.xaml : http://pastebin.com/U54KmFi3 ; and my view: http://pastebin.com/CjVUs5at ; i have not applied the resource to my App.xaml. i've applied it to my view. – JuHwon Feb 26 '13 at 08:59
  • THank you for your hint!!!! i added it to my App.xaml - know it works.. was kind of desperate – JuHwon Feb 26 '13 at 11:17

1 Answers1

2

I didnt had my xaml ResourceDictionary in my App.xaml. I dont know why... though if i place it there it all works fine.

JuHwon
  • 2,033
  • 2
  • 34
  • 54