Far*_*yev 11 c# wpf wpfdatagrid
我有一个DataGrid.但我想在CopyingRowClipboardContent事件中获得专注的细胞价值.但是e.ClipboardRowContent因为它返回了所有选定的单元格值SelectionUnit.我不能改变datagrid的选择单位.为了解决这个问题,我需要获得有针对性的细胞柱数.然后我将从中删除所有列值clipboarcContent.如何在CopyingRowClipboardContent事件中获得专注的细胞?
Den*_*sic 16
改进版Farhad的答案
private void DataGrid_CopyingRowClipboardContent(object sender, DataGridRowClipboardEventArgs e)
{
var currentCell = e.ClipboardRowContent[ dataGrid.CurrentCell.Column.DisplayIndex];
e.ClipboardRowContent.Clear();
e.ClipboardRowContent.Add( currentCell );
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12092 次 |
| 最近记录: |