We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Change background color of the very first column

Hi there,

How can I change background color of the "tool" column?
I've already tried:
  <Style x:Key="headerCellStyle" TargetType="syncfusiongrid:GridHeaderCellControl">
            <Setter Property="Background" Value="DarkRed" />
        </Style>

all columns get filled with DarkRed color except the first one. (see attachment)

thanks in advance.




Attachment: 1_c188b289.zip

1 Reply

FP Farjana Parveen Ayubb Syncfusion Team November 13, 2014 02:12 PM UTC

Hi Vladimir,

Thank you for contacting Syncfusion support.

We have analyzed your query. If you set the HeaderStyle property in grid, style will be applied for all the column headers in the grid. So if you want to set the style for particular column only, you can use the HeaderStyle property in the GridColumn. And if you need to set the style for particular column, you can use the CellStyle property in grid column.

Please refer the below code snippet and sample in the following location:

Code Snippet:

Please refer the below code snippet for styling the HeaderCell and GridCell

<Page.Resources>

        <Style x:Key="headerstyle" TargetType="syncfusion:GridHeaderCellControl">

            <Setter Property="Background" Value="Red" />

        </Style>

        <Style x:Key="cellstyle" TargetType="syncfusion:GridCell">

            <Setter Property="Background" Value="Red" />

        </Style>

    </Page.Resources>

 

Please refer the below code snippet for setting the style to the particular column.

    <syncfusion:SfDataGrid.Columns>

                    <syncfusion:GridTextColumn MappingName="ProductId" CellStyle="{StaticResource cellstyle}" HeaderStyle="{StaticResource headerstyle}"/>

                    <syncfusion:GridTextColumn MappingName="ProductName"/>

                </syncfusion:SfDataGrid.Columns>

 

UG Link: https://help.syncfusion.com/UG/winrt/default.htm#!Documents/stylingcells.htm


Regards,

Farjana Parveen A


Attachment: SfDataGrid_Changing_Background_color_fa25e1c7.zip

Loader.
Live Chat Icon For mobile
Up arrow icon