2011-10-15 49 views
1

我已經從列表中加載數據網格。將每個點擊事件添加到按鈕時,它會將數據加載到LIST,並最終通過重置源來更新DataGrid。從DataGrid事件更新列表項CellEditEnding

接下來我想要做的是編輯該DataGrid的單元格中的值,並將其添加回列表中。

我已經使用結構將數據添加到列表項和DataGrid。 這是結構:

public struct MyData { 
public string item{get;set;} 
public int number{get;set;} 
} 

這裏是CellEditEnding事件代碼。

int index = DataGrid1.SelectedIndex; 
// I KNOW PROBLEM IS HERE as it selects the previous value not the changed value. 
MyData foo = (MyData)DataGrid1.SelectedItem; 
DataGrid1[index] = new MyData{item=foo.item.ToString(), number = 5} 

幫我...

回答

0

您的問題仍然是,我不清楚,但使用 DataGridCellEditEndingEventArgs在CellEditEnding事件到GT所需的值........ this鏈接屬性這可能會幫助你。

相關問題