Change DataGrid row background based on current item.Status #17788
-
I would like to change the background of entire row based on row If not possible I think the alternative would be set the text in Red. Are two |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
This could do it: <DataGrid ...>
<DataGrid.RowTheme>
<ControlTheme
x:DataType="vm:YourItemType"
BasedOn="{StaticResource {x:Type DataGridRow}}"
TargetType="DataGridRow">
<Setter Property="Background" Value="{Binding Status, Converter={StaticResource StatusToRowColorConverter}}" />
</ControlTheme>
</DataGrid.RowTheme>
</DataGrid> Docs about making a custom converter here. (I made up If your viewmodel object is observable and property |
Beta Was this translation helpful? Give feedback.
This could do it:
Docs about making a custom converter here. (I made up
StatusToRowColorConverter
, you'd have to implement that yourself)If your viewmodel object is observable and property
Status
raises aPropertyChanged
the DataGridRow will respond to it.