在WPF中,单击DataGrid,如何获取当前点击的行? 比如在MouseDoubleClick事件中,事实上获取的选中行是一个DataRowview,你可以通过以下的方法来获取选中行的数据,需要引用system.IO 和System.Data; var a =this.exDataGrid.selectItem; var b= a as DataRowView; 或者var b=(DataRowView) exDataGrid.selectItem b["FiledName"].To
方法一:DataRowView mySelectedElement = (DataRowView)dataGrid1.SelectedItem; string result = mySelectedElement.Row[0]ToString(); 方法二:var a = this.dataGrid1.SelectedItem; var b = a as DataRowView;string result = b.Row[0].ToString();
方法一: DataRowView mySelectedElement = (DataRowView)dataGrid1.SelectedItem; ]ToString(); 方法二: var a = this.dataGrid1.SelectedItem; var b = a as DataRowView; ].ToString();
[0]是指当前行第1列的单元格位置 注意:DataRowView要求必须引用System.Data命名空间 方法一: DataRowView mySelectedElement = (DataRowView)dataGrid1.SelectedItem; int result = Convert.ToInt32(mySelectedElement.Row[0]); 方法二: var a = this.dataGrid1.SelectedItem;var b = a as DataRowView;
<!--*********************************************************************************** Extended WPF Toolkit Copyright (C) - Xceed Software Inc. This program is provided to you under the terms of the Microsoft Public License (Ms-PL) as published at h
WPF DataGrid Custommization using Style and Template 代码下载:http://download.csdn.net/detail/wujicai/8104531 customize DataGridRowHeader, DataGridColumnHeader, DataGridCell, DataGridRow styles & templates and change the ScrollBar style in DataGri In
原文:WPF中获取TreeView以及ListView获取其本身滚动条的方法,可实现自行调节scoll滚动的位置(可相应获取任何控件中的内部滚动条) 对于TreeView而言: TreeViewAutomationPeer lvap = new TreeViewAutomationPeer(treeView); var svap = lvap.GetPattern(PatternInterface.Scroll) as ScrollViewerAutomationPeer; var scroll