Category / Section
How to change cell foreground when themes applied or TextBlock styled?
1 min read
You can set foreground for the cells by writing style of TargetType GridCell and setting Foreground. GridCell loads TextBlock as its content. So if style for TextBlock is defined in application or themes applied then, Foreground will not be changed based in GridCell foreground. You can overcome this problem by setting TextBlock style inside GridCell.Resources as below,
<Window.Resources> <Style x:Key="ApplyCellStyle" TargetType="syncfusion:GridCell"> <Style.Resources> <ResourceDictionary> <Style TargetType="TextBlock" /> </ResourceDictionary> </Style.Resources> <Setter Property="Foreground" Value="Blue" /> </Style> </Window.Resources>
Sample: