2013-05-31 21 views
0

我使用以下代碼綁定DataGrid,並且在添加或刪除代碼隱藏行時似乎都有效 - 網格自動按預期方式顯示添加或刪除的行。但是,當用戶單擊頁面中的按鈕時,我在語法上更新所有記錄中的列。這些更新不會立即在網格中更新,因此我正在嘗試找到實現此目的的方法。這是一個問題或重新綁定到網格或有自動的東西,因爲應該處理這個observablecollection?當底層數據更改時更新Silverlight DataGrid

// Get the Disaster ID selected 
_selectedDisaster = (DisasterEvent)combo.SelectedItem; 


// Return volunteers that have been selected 
// And populate the grid 
Binding b = new Binding(""); 
b.Mode = BindingMode.OneWay; 
b.Source = DisasterEvent_Volunteers; 


this._grid_SelectedVolunteers.SetBinding(DataGrid.ItemsSourceProperty, b); 
this._grid_SelectedVolunteers.AutoGenerateColumns = true; 

回答

相關問題