WPF中,DATAGRID绑定的DATATABLE,列是不固定可变的,现在通过dataGrid1_LoadingRow设置某行的背景色,请问DataGridRow如何获取某列“A”的单元值?
 
 void dataGrid1_LoadingRow(object sender, DataGridRowEventArgs e)
         {
 
            DataGridRow row = e.Row;

解决方案 »

  1.   

    还有你得到DataGridRow对象的方法有问题。
    this.gridviewName.Rows[e.RowIndex].Cells[index],你可以将此当作一个二维数组来操作
      

  2.   

    row.Cells["A"].value//获取某行某列  dgv.Rows[i].Cells[j].value
      

  3.   

    非常感谢大家的指导!
    不过这里情况不是这么简单,这个是调用的LoadingRow事件在代码中执行动作的,而且应用场景只能在代码中执行!
    DataGridRow 没有 .Row,只有        public object GetValue(DependencyProperty dp);
    这里不知道怎么写DependencyProperty 
    请大家指导!