Articles in this section
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:

WPF

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied