Hi,
I have some code that loads settings for my grid. The code is executed from within the OnFieldLayoutInitialized() method after my fields have been created.
When I attempt to add a FieldSortDescription to the SortedFields collection in my layout, I get a null reference exception. Is there some pre-requisite for being able to do this? Maybe I'm missing something? Any ideas?
Thanks
at Infragistics.Windows.DataPresenter.UnsortedRecordSparseArray.GetItem(Int32 index, Boolean create, Boolean calledFromSortedManagerSparseArray, Boolean& newRowCreated) at Infragistics.Windows.DataPresenter.UnsortedRecordSparseArray.GetItem(Int32 index, Boolean create) at Infragistics.Windows.DataPresenter.DataRecordCollection.get_Item(Int32 index) at Infragistics.Windows.DataPresenter.RecordManager.VerifySort() at Infragistics.Windows.DataPresenter.DataPresenterBase.OnProcessSortCriteria(FieldLayout fieldLayout) at Infragistics.Windows.DataPresenter.DataPresenterBase.OnSortCriteriaChanged(FieldLayout fieldLayout) at Infragistics.Windows.DataPresenter.FieldLayout.BumpSortVersion() at Infragistics.Windows.DataPresenter.FieldLayout.OnSortedFieldsCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) at Infragistics.Windows.DataPresenter.FieldSortDescriptionCollection.RaiseCollectionChangedEvent(NotifyCollectionChangedEventArgs e) at Infragistics.Windows.DataPresenter.FieldSortDescriptionCollection.InsertItem(Int32 index, FieldSortDescription fsd) at Infragistics.Windows.DataPresenter.FieldSortDescriptionCollection.Add(FieldSortDescription item)
Hello,
Thank you for your feedback. I am glad that you have been able to resolve your issue. However the null reference exceptions are Microsoft’s and we are not able to control them.
Thanks again.
Issue was related to the DataSource being set to null after initial binding. In any case, the exception wasn't clear on why it was happening. Perhaps some additional checks can be put in place.
Thank you for your post. I have been looking through it, but I wasn’t able to reproduce your behavior, so if this is still an issue for you, could you please send me an isolated sample project where this is reproduced and I will investigate it further for you.
Looking forward for your reply.