【问题标题】:How to get all the Selected Cells in WPF datagrid如何获取 WPF 数据网格中的所有选定单元格
【发布时间】:2011-11-08 06:51:11
【问题描述】:

我有一个 WPF 数据网格,我想获取网格中所有选定的单元格,我可以通过循环遍历所有项目来做到这一点,那么有没有内置的方法可以做到这一点?

我在DataGrid中设置了两个属性:

SelectionMode="Extended"   // for multiple selection

SelectionUnit="Cell"    //row should not be selected but cell should be

谢谢。

【问题讨论】:

    标签: c# wpf datagrid selection


    【解决方案1】:

    DataGrid 具有SelectedCells 属性。是你要找的吗?

    【讨论】:

      【解决方案2】:

      我知道Grid.selecteditem 适用于行选择;我认为它也应该适用于细胞。

      【讨论】:

        猜你喜欢
        • 2010-12-06
        • 1970-01-01
        • 2011-02-12
        • 1970-01-01
        • 1970-01-01
        • 2020-01-14
        • 1970-01-01
        • 2012-06-19
        • 1970-01-01
        相关资源
        最近更新 更多