I am attempting to change the padding property of a XamGrid HeaderCellControl by creating a style. I would like the style to simply extend the existing themed (MetroDark) style.
<Style x:Key="MyHeaderCellControlStyle" TargetType="igPrim:HeaderCellControl" BasedOn="{StaticResource {x:Type igPrim:HeaderCellControl}}"> <Setter Property="Padding" Value="6,4,0,4" /> </Style>
When I apply the style to my unbound column via HeaderStyle={StaticResource MyHeaderCellControlStyle}", what I am finding is that the new style completely overrides the themed style rather than inheriting and only changing the padding.
I am using the ThemeManager.
Hello ,
To change the padding property of a XamGrid HeaderCellControl you would need to extend MetroDark .xaml file and its all depended files.
In the grid resource section you would need to MetroDark.xamGrid.xaml within the ResourceDictionary’s MergedDictionaries collection.
Now in the grid resource you can have style based on HeaderCellControlStyle.Your code would be something like this:
<Grid.Resources> <ResourceDictionary > <ResourceDictionary.MergedDictionaries > <ResourceDictionary Source="MetroDark.xamGrid.xaml"></ResourceDictionary> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Grid.Resources> <ig:XamGrid ItemsSource="{Binding}" IsAlternateRowsEnabled="True" > <ig:XamGrid.Resources >
<Style TargetType="igPrim:HeaderCellControl" BasedOn="{StaticResource HeaderCellControlStyle}"> <Setter Property="Foreground" Value="red"/> </Style>
</ig:XamGrid.Resources> <ig:XamGrid.RowSelectorSettings> <ig:RowSelectorSettings Visibility="Visible" EnableRowNumbering="True"/> </ig:XamGrid.RowSelectorSettings> </ig:XamGrid>
I have also attached the sample project I have created in order to test this.
Please find the attached sample and let me know if you need further assistance.
6237.WpfApplication1.zip