I have something like orders table bound to a DataGrid
.
I want to disable editing on rows, where order date is expired (deadline date > current date): show them greyed and ban entering into edit mode.
Here is what I have:
<Style TargetType="{x:Type WPFToolkit:DataGridRow}">
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<!-- ??? order_date > current_date -->
<!-- some other condition - already works -->
</MultiTrigger.Conditions>
<Setter Property="IsEnabled" Value="False"/>
<Setter Property="Foreground" Value="LightGray"/>
</MultiTrigger>
</Style.Triggers>
</Style>
The order date is a template column defined as follows:
<WPFToolkit:DataGridTemplateColumn SortMemberPath="order_date" Header="Deadline" >
<WPFToolkit:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=order_date,
ConverterCulture='ru-RU', StringFormat='{}{0:d}'}" />
</DataTemplate>
</WPFToolkit:DataGridTemplateColumn.CellTemplate>
<WPFToolkit:DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<WPFToolkit:DatePicker SelectedDate="{Binding Path=order_date}" />
</DataTemplate>
</WPFToolkit:DataGridTemplateColumn.CellEditingTemplate>
</WPFToolkit:DataGridTemplateColumn>
Is there a way to disable editing mode in rows where order date has expired?