How to: Implement Conditional Formatting for Rows
The following sample demonstrates how to change the appearance of grid rows based on a condition.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-implement-conditional-formatting-for-rows-e983.
<Window x:Class="ConditionalRowFormatting.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxgt="http://schemas.devexpress.com/winfx/2008/xaml/grid/themekeys"
xmlns:local="clr-namespace:ConditionalRowFormatting"
Title="Window1"
Height="430"
Width="610">
<Window.Resources>
<ResourceDictionary>
<local:SimpleDataList x:Key="simpleSource" InitCount="25" />
</ResourceDictionary>
</Window.Resources>
<Grid>
<dxg:GridControl ItemsSource="{StaticResource simpleSource}" AutoGenerateColumns="AddNew">
<dxg:GridControl.View>
<dxg:TableView AutoWidth="True" AllowConditionalFormattingMenu="True">
<dxg:TableView.FormatConditions>
<dxg:ColorScaleFormatCondition Expression="[Int]" PredefinedFormatName="RedWhiteBlueColorScale" />
</dxg:TableView.FormatConditions>
</dxg:TableView>
</dxg:GridControl.View>
</dxg:GridControl>
</Grid>
</Window>