Hi,
I have the following grid:
<igDP:XamDataGrid Grid.Row="1" DataSource="{Binding LoadedEvents}" behaviors:XamGridSelectionChanged.SelectionChangedCommand="{Binding SelectionChangedCommand}" Theme="Office2k7Black" RecordActivating="XamDataGrid_RecordActivating"> <igDP:XamDataGrid.FieldSettings> <igDP:FieldSettings AllowRecordFiltering="true"/> </igDP:XamDataGrid.FieldSettings> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AutoGenerateFields="False" FilterUIType="FilterRecord"/> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:FieldLayout.Fields> ... </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> <igDP:XamDataGrid.Resources> <Style TargetType="{x:Type igDP:DataRecordCellArea}"> <Setter Property="OverridesDefaultStyle" Value="False"/> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.BasketEventStatusString}" Value="None"> <Setter Property="Background" Value="#FFE4EBF2" /> </DataTrigger> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.BasketEventStatusString}" Value="AlmostExDate"> <Setter Property="Background" Value="#FFF9EFA9" /> </DataTrigger> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.BasketEventStatusString}" Value="ExDateOrLater"> <Setter Property="Background" Value="#FFF5D7D7" /> </DataTrigger> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.BasketEventStatusString}" Value="SignedOff"> <Setter Property="Background" Value="#FFD4F5D4" /> </DataTrigger> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.BasketEventStatusString}" Value="Complete"> <Setter Property="Background" Value="#FFD4F5D4" /> </DataTrigger> </Style.Triggers> </Style> </igDP:XamDataGrid.Resources>
The thing is that with these styles in the Resources of the grid the theme looks like not being applied, is there any solution for this? Also if I put the Styles outside the resources the theme is applyed but the styles are ignored.
Thanks,
Fede
Hi I sorted it out, it was that I have to use: DataPresenterOffice2k7Black.DataRecordCellArea instead.
Hi Alex,
I tryed doing what it says on the link you sent but I get:
Cannot find the type Office2k7Black. Note that the type names are case sensitive.
Can you tell me what am I doing wrong?
I send my XAML below.
Federico
<Style TargetType="{x:Type igDP:DataRecordCellArea}" BasedOn="{x:Static igThemes:Office2k7Black.DataRecordCellArea}" > <Setter Property="OverridesDefaultStyle" Value="False"/> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.BasketEventStatusString}" Value="None"> <Setter Property="Background" Value="#FFE4EBF2" /> </DataTrigger> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.BasketEventStatusString}" Value="AlmostExDate"> <Setter Property="Background" Value="#FFF9EFA9" /> </DataTrigger> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.BasketEventStatusString}" Value="ExDateOrLater"> <Setter Property="Background" Value="#FFF5D7D7" /> </DataTrigger> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.BasketEventStatusString}" Value="SignedOff"> <Setter Property="Background" Value="#FFD4F5D4" /> </DataTrigger> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.BasketEventStatusString}" Value="Complete"> <Setter Property="Background" Value="#FFD4F5D4" /> </DataTrigger> </Style.Triggers> </Style>
Hello Fede,
This happens because WPF supports only one local style. Andrew Smith explains these two issues and how to avoid them thoroughly in his blog post, which you can find here.