我有一个DataGrid:
<DataGrid x:Name="messageGrid" BorderBrush="#FFF0F0F0" AutoGenerateColumns="False" SelectionMode="Extended">
<DataGrid.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
Color="Transparent" Opacity="0"/>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
</DataGrid.Resources>
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Background" Value="{Binding Priority, Converter={StaticResource PriorityToColorConverter}}" />
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Path=Date}" CanUserSort="False" CanUserReorder="False" Header="Дата" IsReadOnly="True" Width="200"/>
<DataGridTemplateColumn CanUserSort="False" CanUserReorder="False" Header="Квитирование" Width="200" CellTemplateSelector="{StaticResource NameTemplateSelector}" />
<DataGridTextColumn Binding="{Binding Path=Text}" CanUserSort="False" CanUserReorder="False" Header="Сообщение" IsReadOnly="True" Width="*"/>
</DataGrid.Columns>
</DataGrid>
第二列的模板之一是:
<DataTemplate x:Key="nonKvited">
<Button Name="PART_Editor" Content="Квитировать" Margin="1,1,1,1" Click="KvitInGridClick" CommandParameter="{Binding Path=Row}"/>
</DataTemplate>
因此,网格单元内有一个按钮。单击此按钮后,我需要处理显示在适当行中的数据。我试图将这些数据放在CommandParameter中,但是找不到绑定的路径。