Skip to content

DevExpress-Examples/wpf-grid-customize-appearance-of-specific-cells

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WPF Data Grid - Customize appearance settings of cells based on column and row index

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>

Files to Review

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)