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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change the background of the RowHeader based on the business logic?

RowHeader is a special Column used to indicate the row status like CurrentRow, Editing status, Errors in row, etc. You can enable or disable the RowHeader by setting the ShowRowHeader property in SfDataGrid.

RowHeader allows you to customize the background based on the business logic .By default the RowHeader has the following format as illustrated in the following screenshot.

Figure 1: Default style of GridRowHeaderCell

You can change the background color of the RowHeader by customizing the style of the GridRowHeaderCell’s Background property based on the business logic. A converter is used to change the appropriate background color based on business logic values.

XAML

The Background color is changed to Red when the Status property value of the Data class is set to true else the RowHeader’s color is changed to Green Color.

C#

C:\Users\ApoorvahR\Desktop\Note.pngNote: Using converters in Style is applicable only for WPF and Silverlight.

In Silverlight, the color is applied to the corresponding business logic as illustrated in the following code example.

C#

The following screenshot displays the customized GridRowHeaderCell’s style.

Figure 2: After customizing the GridRowHeaderCell Style

 

You can refer to the following samples to change the background of the RowHeader based on the business logic of SfDataGrid.

 

WPF: BackgroundColorForRowHeader_WPF

SilverLight: BackgroundColorForRowHeader_SilverLight

 

Article ID: Published Date: Last Revised Date: Platform: Control:
3115 01/07/2015 06/04/2015 Silverlight SfDataGrid
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon