Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to style a cell at a certain position, using the MultiBindingConverter, to pass the column and row index

$
0
0

It's possible to pass any value to the converter. In the Convert method the value of the property is passed, to which the Setter Value property was bound. To bind to the RowHandle.Value, use the following style:

<Style x:Key="customCellStyle" TargetType="dxg:CellContentPresenter">
   <Setter Property="Background"
           Value="{Binding Path= Data.RowHandle.Value,
           Converter={local:YourConverter}}"/>
</Style>

Note the data context of the cell style for the View is the RowData (RowData Members )
However, it's possible to bind to properties of the CellContentPresenter itself (CellContentPresenter Members ).

To bind to the GridColumn.VisibleIndex, write the following style:

<Style x:Key="customCellStyle" TargetType="dxg:CellContentPresenter">
   <Setter Property="Background"
           Value="{Binding Path= Column.VisibleIndex, RelativeSource={RelativeSource Self},
           Converter={local:YourConverter}}"/>
</Style>

Use multi binding, to pass two values to the converter. The sample illustrates how to use multi binding.

Update: Take special note of our Conditional Formatting as well.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>