微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

我想要获取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.

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

原文地址:https://www.jb51.cc/csharp/93888.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐