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