Note: Use Conditional Formatting to easily highlight cells or rows based on specified criteria without writing a single line of code.
This example creates ColumnRowIndexesCellValueConverter
and uses multi-binding to customize the appearance of cells based on column and row indices:
<dxg:GridControl x:Name="grid">
<dxg:GridControl.Resources>
<Style x:Key="customCellStyle" BasedOn="{StaticResource {dxgt:GridRowThemeKey ResourceKey=LightweightCellStyle}}" TargetType="{x:Type dxg:LightweightCellEditor}">
<Setter Property="Background">
<Setter.Value>
<MultiBinding>
<MultiBinding.Converter>
<local:ColumnRowIndexesCellValueConverter />
</MultiBinding.Converter>
<Binding Path="Column" RelativeSource="{RelativeSource Self}" />
<Binding Path="Data.RowHandle.Value" />
</MultiBinding>
</Setter.Value>
</Setter>
</Style>
</dxg:GridControl.Resources>
<dxg:GridControl.View>
<dxg:TableView AutoWidth="True" CellStyle="{StaticResource customCellStyle}" />
</dxg:GridControl.View>
<dxg:GridControl.Columns>
...
</dxg:GridControl.Columns>
</dxg:GridControl>
- Window1.xaml (VB: Window1.xaml)
- Window1.xaml.cs (VB: Window1.xaml.vb)
(you will be redirected to DevExpress.com to submit your response)