Silvelight应用程序抛出绑定到Grid的清除列表上的Null引用异常

时间:2017-05-30 10:22:16

标签: silverlight grid infragistics

在Silverlight应用程序中,我将一个ObservableCollection绑定到Grid。

但是当我编辑网格行时,我将在db中保存更新的数据并清除可观察的网格集合并在其中重新插入新值。

但是当我尝试清除可观察集合时,它会抛出错误“对象引用未设置为对象的实例”

我错过了这里的任何东西。

代码:

MyList.Clear(); 
  

StackTrace of Exception

     

在   Infragistics.AutomationPeers.CellsPanelAutomationPeer.Row_PropertyChanged(对象   sender,PropertyChangedEventArgs e)\ r \ n at   System.ComponentModel.PropertyChangedEventHandler.Invoke(对象   sender,PropertyChangedEventArgs e)\ r \ n at   Infragistics.RecyclingContainer 1.OnPropertyChanged(String name)\r\n
at Infragistics.Controls.Grids.Row.SetSelected(Boolean isSelected)\r\n at Infragistics.Controls.Grids.Row.Infragistics.ISelectableObject.SetSelected(Boolean isSelected)\r\n at Infragistics.Controls.Grids.SelectedCollectionBase
1.InternalRemoveItemSilently(的Int32   索引)\ r \ n at   Infragistics.Controls.Grids.SelectedCollectionBase 1.RemoveItem(Int32 index)\r\n at Infragistics.Collections.CollectionBase 1.去除(T   项目)\ r \ n at   Infragistics.Controls.Grids.RowsManager.InvalidateSelectionAndActivation(布尔   validateInList,Boolean invalidateSelection)\ r \ n at   Infragistics.Controls.Grids.RowsManager.InvalidateItemSource(布尔   invalidateSelection)\ r \ n at   Infragistics.Controls.Grids.RowsManager.DataManager_CollectionChanged(对象   sender,NotifyCollectionChangedEventArgs e)\ r \ n at   Infragistics.DataManagerBase.OnCollectionChanged(NotifyCollectionChangedEventArgs   e)\ r \ n at   Infragistics.DataManagerBase.OnDataSourceCollectionChanged(NotifyCollectionChangedEventArgs   e)\ r \ n at   Infragistics.DataManager 1.OnDataSourceCollectionChanged(NotifyCollectionChangedEventArgs e)\r\n at Infragistics.DataManagerBase.DataSource_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)\r\n at System.Collections.ObjectModel.ObservableCollection 1.OnCollectionChanged(NotifyCollectionChangedEventArgs   e)\ r \ n at   System.Collections.ObjectModel.ObservableCollection 1.ClearItems()\r\n at System.Collections.ObjectModel.Collection 1.Clear()\ r \ n at

0 个答案:

没有答案