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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to apply alternate row colors in SfDataGrid?

SfDataGrid allows you to set alternate row color by setting the SfDataGrid.GridStyle.AlternatingRowColor property. The default value of this property is Color.Default and hence applies the record background color for all rows by default. On specifying a color value for this property the SfDataGrid appears with alternate row colors.

Refer the following code example which illustrates how to set AlternatingRowColor in SfDatGrid.


SfDataGrid allows you to customize the rows for which the alternate row color needs to be updated based on the property SfDataGrid.AlternationCount.


SfDataGrid also allows you to customize the AlternatingRowColor when switching themes in runtime. This can be achieved by writing a custom style class derived from DataGridStyle and returning the color need to be applied for alternate rows in the GetAlternatingRowBackgroundColor() override.


Refer the below code example to know how to apply the custom style to SfDataGrid.


The following screenshot shows the final outcome upon execution of the above code

Article ID: Published Date: Last Revised Date: Platform: Control:
6207 02/03/2016 02/03/2016 Xamarin.iOS SfDataGrid
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Please sign in to access our KB

or the page will be automatically redirected to sign-in page in 10 seconds.

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