3
XML按鈕在DataGrid列,讓行的單元格的值由它來對Click事件處理程序
Object Id = new Object();
Id = ((Button)sender).Tag;
是一種可能的方式來檢索選定行的所有單元格的值?如果,我該怎麼做?否則,請建議我採用其他方式從datagrid更新數據集。提前致謝 。 :)
XML按鈕在DataGrid列,讓行的單元格的值由它來對Click事件處理程序
Object Id = new Object();
Id = ((Button)sender).Tag;
是一種可能的方式來檢索選定行的所有單元格的值?如果,我該怎麼做?否則,請建議我採用其他方式從datagrid更新數據集。提前致謝 。 :)
使用這些幫助函數; http://techiethings.blogspot.com/2010/05/get-wpf-datagrid-row-and-cell.html
在Update按鈕,掛鉤Click事件,並在處理程序,做這樣的事情:
//youll need to google for GetVisualParent function.
DataGridRow row = GetVisualParent<DataGridRow>(button);
for(int j = 0; j < dataGrid.Columns.Count; j++)
DataGridCell cell = GetCell(dataGrid, row, j);
我沒有完全理解你想做的事,但是這應該幫助。
該鏈接是相當有幫助的!謝謝:-) – 2012-07-22 16:36:55
不要讓你的答案依賴於外部資源,儘量讓你的答案中的所有必要信息,使其獨立。我剛剛從該鏈接獲得了一個503。 – 2012-07-22 18:43:39