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

前端之家收集整理的这篇文章主要介绍了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.

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

原文链接:/csharp/93888.html

猜你在找的C#相关文章