With
<Style TargetType="syncfusion:GridCell" x:Key="nullCellStyle" >
<Setter Property="Background" Value="LightYellow"/>
<Setter Property="Foreground" Value="Red"/>
</Style>
we have
or
no foreground color is applied and something wrong goes with cell border..
Attachment: SyncfusionTests_31576bf7.zip
Hi Krzysztof,
The reported problem occurs due to defined the default style for GridCell. When
applying the theme to SfDataGrid, we merged the FluentLight merge resource
dictionary into the application. If you want to customize the cell style in
SfDataGrid you should use the relevant key for the target type, which is used
in MergedDictionary. If you didn't define the key, the default style merged,
which is why you saw the default border instead of the applied theme.
However, you can avoid this by adding the ResourceDictionary
based on the applied Theme (ex: FluentLight). BasedOn property bound with SyncfusionGridCellStyle
as StaticResource in defined Style based. Refer to the below code snippet.
<Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <!--Here add the ResourceDictionary for the applied theme in your application--> <ResourceDictionary Source="/Syncfusion.Themes.FluentLight.WPF;component/SfDataGrid/SfDataGrid.xaml"/> </ResourceDictionary.MergedDictionaries>
<!--Here add the BasedOn proeprty for override the theme style for GridCell--> <Style TargetType="syncfusion:GridCell" BasedOn="{StaticResource SyncfusionGridCellStyle}" x:Key="nullCellStyle" > <Setter Property="Background" Value="LightYellow"/> <Setter Property="Foreground" Value="Red"/> </Style> </ResourceDictionary> </Application.Resources> |
Find the modified sample in the attachment.
Regards,
Vijayarasan S
If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.
thanks but what if i want to change theme at runtime ?
doing that
<ResourceDictionary.MergedDictionaries>
<!--Here add the ResourceDictionary for the applied theme in your application-->
<ResourceDictionary Source="/Syncfusion.Themes.FluentLight.WPF;component/SfDataGrid/SfDataGrid.xaml"/>
<ResourceDictionary Source="/Syncfusion.Themes.FluentDark.WPF;component/SfDataGrid/SfDataGrid.xaml"/>
</ResourceDictionary.MergedDictionaries>
my message from 12:06 was not claer please ignore.
I really appreciate your help - thank you.