我想将Id
字段绑定到 Xceed DataGrid 列内的 Image 标记。
<xcdg:Column FieldName="D" Title="Delete" Width="50" CellHorizontalContentAlignment="Center" CellVerticalContentAlignment="Center">
<xcdg:Column.CellContentTemplate>
<DataTemplate>
<Image Source="{StaticResource imgDelete}" Tag="{Binding Id}" Width="16" Height="16" Cursor="Hand"
x:Name="imgEdit" MouseLeftButtonUp="imgDelete_MouseLeftButtonUp" ToolTipService.ToolTip="Edit" />
</DataTemplate>
</xcdg:Column.CellContentTemplate>
</xcdg:Column>
但是在事件处理程序中,我将 Tag 设为 null:
private void imgDelete_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
AreaId = Convert.ToInt32((sender as Image).Tag);
catch (Exception en)
}