将单元格内容复制到剪贴板 RadGridView WPF

Copy cell content to clipboard RadGridView WPF

我在 RadGridView 工作,我需要复制单元格内容。

作为应用程序功能的一部分,我希望网格 SelectionUnit 始终为 Row 类型。除此之外,我们还想公开一种机制,用户可以 select 将单元格值复制到剪贴板。

有办法吗?例如,双击一个单元格复制单元格值,而单击总是 select 行。

试试这个,

不完美,但符合您的要求。

void testGridView_CopyingCellClipboardContent(object sender, GridViewCellClipboardEventArgs e)
{
    if (grdName.CurrentCell != null && grdName.CurrentCell.Column == e.Cell.Column)
    {
        e.Cancel = false;
    }
    else
        e.Cancel = true;
}

将您的 GridView 名称替换为 "grdName"。