Skip to content

Latest commit

 

History

History
63 lines (45 loc) · 4.23 KB

File metadata and controls

63 lines (45 loc) · 4.23 KB

Build Binding Paths in WPF Data Grid Rows

image

Row elements contain RowData objects in their DataContext. Use the following binding paths to access cell values and ViewModel properties:

The bindings used in this example work as follows:

  • Bind the row Background to the Color property stored at the item level:
<Trigger Property="SelectionState" Value="None">
    <Setter Property="Background" Value="{Binding Row.Color, Converter={dxmvvm:ColorToBrushConverter}}" />
</Trigger>
  • Highlight a row when the HighlightVisited property of the grid's ViewModel and the Visited column value are true:
<MultiDataTrigger>
    <MultiDataTrigger.Conditions>
        <Condition Binding="{Binding View.DataContext.HighlightVisited}" Value="True" />
        <Condition Binding="{Binding DataContext.Visited}" Value="True" />
    </MultiDataTrigger.Conditions>
    <Setter Property="TextElement.FontStyle" Value="Italic" />
    <Setter Property="TextElement.FontWeight" Value="Bold" />
</MultiDataTrigger>

Files to Look at

Documentation

More Examples

Does this example address your development requirements/objectives?

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