复制不适用于DataGrid模板化列?

时间:2021-05-13 19:55:49

When working with templated column in WPF datagrid, you cann't copy cell content anymore, does anyone knows how this can be solved?

在WPF数据网格中使用模板化列时,您不能再复制单元格内容了,有谁知道如何解决这个问题?

1 个解决方案

#1


21  

You need to set the ClipboardContentBinding property to the desired property in the row item, see the following code:

您需要将ClipboardContentBinding属性设置为行项目中的所需属性,请参阅以下代码:

<DataGrid>
        <DataGrid.Columns>
            <DataGridTemplateColumn ClipboardContentBinding="{Binding YouProperty}">

            </DataGridTemplateColumn>
        </DataGrid.Columns>
</DataGrid>

#1


21  

You need to set the ClipboardContentBinding property to the desired property in the row item, see the following code:

您需要将ClipboardContentBinding属性设置为行项目中的所需属性,请参阅以下代码:

<DataGrid>
        <DataGrid.Columns>
            <DataGridTemplateColumn ClipboardContentBinding="{Binding YouProperty}">

            </DataGridTemplateColumn>
        </DataGrid.Columns>
</DataGrid>