Reputation: 205
I'm trying to change inactive data with strikethrough decoration.
<DataGrid.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="IsTabStop" Value="True" />
<Setter Property="TextDecorations" Value="{Binding SelectedEntryType.TypeOfEntry, Converter={StaticResource DisplayValueToStrikethrough}}"/>
</Style>
</DataGrid.CellStyle>
The problem is the following: The member "TextDecorations" is not recognized or is not accessible.
I'm using MVVM design pattern.
I already added the System.Windows dll. How can I fix this error? Thank you.
Upvotes: 0
Views: 1105
Reputation: 22702
Try write TextBlock.TextDecorations
like this:
<Setter Property="TextBlock.TextDecorations"
Value="{Binding SelectedEntryType.TypeOfEntry, Converter={StaticResource DisplayValueToStrikethrough}}" />
Edit
In this case, you need to implement DataGridTemplateColumn
with TextBlock
or use ElementStyle
for DataGridTextColumn
:
<DataGridTextColumn Header="Test">
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="TextDecorations" Value="Strikethrough" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
Upvotes: 1