2011年6月13日

WPF DataGrid获取选择行的数据

摘要: 在WPF中,单击DataGrid,如何获取当前点击的行?比如在MouseDoubleClick事件中,事实上获取的选中行是一个DataRowview,你可以通过以下的方法来获取选中行的数据,需要引用system.IO 和System.Data;var a =this.exDataGrid.selectItem;var b= a as DataRowView;或者var b=(DataRowView) exDataGrid.selectItemb["FiledName"].ToString(); 其中的数据你可以直接转换但要注意一个问题,如果你的DataGrid的ItemsS 阅读全文

posted @ 2011-06-13 10:42 Chicano 阅读(30214) 评论(0) 推荐(3)

导航