例如:
// Create an instance of the 'CurrentCellChanged' EventHandler.
private void CallCurrentCellChanged()
{
   myDataGrid.CurrentCellChanged += new EventHandler(Grid_CurCellChange);
}// Raise the event when focus on DataGrid cell changes.
private void Grid_CurCellChange(object sender, EventArgs e)
{
   // String variable used to show message.
   string myString = "CurrentCellChanged event raised, cell focus is at ";
   // Get the co-ordinates of the focussed cell.
   string myPoint  = myDataGrid.CurrentCell.ColumnNumber + "," +
                  myDataGrid.CurrentCell.RowNumber;
   // Create the alert message.
   myString = myString + "(" + myPoint + ")";
   // Show Co-ordinates when CurrentCellChanged event is raised.
   MessageBox.Show(myString, "Current cell co-ordinates");

解决方案 »

  1.   

    你在datagrid中加一个选择列,CommandName为Select,点击就会触发datagrid_itemCommand事件了
      

  2.   

    我用CallCurrentCellChanged解决了选择的问题
    但是多选呢原来用lisview比较方便,
    if(lsvList.SelectedItems.Count>0)   
    i<lsvList.SelectedItems.Count ; i++)
    dataGrid,1是好像选起来不可以2是如何判断
      

  3.   

    DataGrid.Select 方法 (Int32) 可以选中某一行,
    DataGrid.UnSelect 方法 取消指定行的选定。
    DataGrid.IsSelected 方法 获取一个值,该值指示指定行是否被选定。
      

  4.   

    你可以用DataGrid.IsSelected(int row) 方法查看某一行是否是选中状态.另外,控件的功能不一样,使用也会不同,也不可能完全等同,所以,如果很不合要求就换用控件吧.