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;
是的,我需要将它添加到我的基础数据类。仅仅依靠ObservableCollection是不够的。感谢您的提醒!! – ChiliYago