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 change the row background based on property in record?

Platform: WPF |
Control: SfDataGrid |
Published Date: April 14, 2016 |
Last Revised Date: April 18, 2016 |
.NET Framework: 4.5 |
Product Version: 13.4.0.53

The background of row can be changed dynamically based on any property value in record by writing style of TargetType as VirtualizingCellsControl. In the style setter the background can be changed based on property value using converter.

In the below code snippet, VirtualizingCellsControl’s background is changed based on IsChecked property in data object using converter.

XAML

 

C#

 

Sample: AutoRefresh_SingleBinding

 

If you want to change the background based on two properties in underlying data object, then you can pass the data object to converter using MultiBinding.

In the below code snippet, the row background is change based on record in CustomRowStyleMultiValueConverter.

XAML

 

C#

Sample

AutoRefresh_MultiBinding

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the 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