What is the best (easy) way to set the font to a strikethrough style on individual cells of the WPF DataGrid?
...
Options that I'm aware of are inserting TextBlock controls in individual cells or using a DataGridTemplateColumn - and using the TextDecorations property therein. Either way this is quite a mission, I'd like to use the default AutoGenerate Columns function of DataGrid, especially since my ItemsSource is a DataTable.
As and aside, is there any way to access the TextBlock generated using the default DataGridTextColumn?
<DataGridTextColumn Binding="{Binding Name}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="TextDecorations" Value="Strikethrough"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
Of course you can wrap the setter in a DataTrigger to use it selectively.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With