Home > Net >  Setting a style for Columns in a WPF DataGrid
Setting a style for Columns in a WPF DataGrid

Time:02-10

I have a WPF data grid as below,

<DataGrid Grid.Row="1"   ItemsSource="{Binding Items}"  AlternationCount="2">
<DataGridDateColumn Binding="{Binding Date} Header="Date of Creation" Width="*"/>
<DataGridTextColumn Binding="{Binding Name}" Header="Name" Width="*"/>
</DataGrid>

I am trying to figure out a way to set a style to each of rows under these columns, I have a boolean value in my ViewModel, Bool IsAvailable and I want to set a style such that TextDecorations="Strikethrough" will be applied to each row where this bool IsAvailable is set to false.

Any suggestions on how I can get started as I am slightly confused if / and how I can use a style trigger with this datagrid.

Some direction would be greatly appreciated

CodePudding user response:

  •  Tags:  
  • Related