I have a datagrid which uses Styles of DataGridCell type to disable some cells depending on value from another cell of same row.
Below is the XAML for Style
<Style x:Key="testCellStyle" TargetType="{x:Type DataGridCell}">
<Style.Triggers>
<DataTrigger Binding="{Binding Segment}" Value="0">
<Setter Property="IsEnabled" Value="False"/>
</DataTrigger>
<DataTrigger Binding="{Binding Segment}" Value="1">
<Setter Property="IsEnabled" Value="True"/>
</DataTrigger>
</Style.Triggers>
</Style>
This part is working as intended.
Now, as the columns are bound to VM properties which update the database accordingly, I need to empty the cell before disabling it so as to not to persist junk values in the DB.
Being new to C#, I'd prefer to use XAML for this purpose if possible.
How can this behavior be achieved?