加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – WPF Datagrid获取所选单元格值

发布时间:2020-12-15 03:44:12 所属栏目:百科 来源:网络整理
导读:我想要获取datagrid中所选单元格的值,请任何人告诉如何做到这一点.我使用了SelectedCell改变的事件,我该怎么办? dataGrid1.CurrentCell 解决方法 请参考MSDN上的 DataGrid Class页.从那个页面: Selection By default,the entire row is selected when a us
我想要获取datagrid中所选单元格的值,请任何人告诉如何做到这一点.我使用了SelectedCell改变的事件,我该怎么办?
dataGrid1.CurrentCell

解决方法

请参考MSDN上的 DataGrid Class页.从那个页面:

Selection

By default,the entire row is selected when a user clicks a cell in a DataGrid,and a user can select multiple rows. You can set the 07001 property to specify whether a user can select cells,full rows,or both. Set the SelectionUnit property to specify whether multiple rows or cells can be selected,or only single rows or cells.

You can get information about the cells that are selected from the 07002 property. You can get information about cells for which selection has changed in the 07003 of the SelectedCellsChanged event. Call the SelectAllCells or UnselectAllCells methods to programmatically select or unselect all cells. For more information,see Default Keyboard and Mouse Behavior in the DataGrid Control.

我已经为您添加了相关属性的链接,但我现在已经不在时间了,所以希望您可以按照链接获取您的解决方案.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读