3 Answers, 1 is accepted
We had the pretty ambitious idea to implement an alternative mode that translates all reset actions to add/remove actions. However, is occurred that most of the WPF ItemsControls do not properly handle an Add/Remove action that contains more than one added/removed item. As RadObservableCollection<T> is widely used out of the scope of our controls, we had to freeze the work on this feature, due to those compatibility issues. Currently it is not possible to prevent Reset after ResumeNotifications.
Regards,
Ivan Ivanov
Telerik by Progress
Hi Michael,
Thank you for the provided feedback.
Upon checking, I can see that this property is described in the Properties section of this article. We will consider adding a note in the section claiming that you can't Reset the collection after ResumeNotifications.
Regards,
Dinko
Progress Telerik
Hi Dinko,
Sorry for necroing this but this is the only thread I could find by searching "ShouldResetOnResumeNotifications" in the forum.
I was curious too about the usage of this property.
I don't see clearly mentioned in the documentation that we can't reset the collection after ResumeNotifications.
After all, if this property is of no use, why do you even keep it exposed in the API?
I think keeping it only makes users lose time when they are looking for its usage, exactly like me right now.
In fact, I think the doc is clearly misinforming! It states:
"Calling the ResumeNotifications method after adding items to the collection with suspended notifications raises the CollectionChanged event with NotifyCollectionChangedAction.Reset."
From my understanding, this means Reset will actually be called after ResumeNotifications, but you state the contrary.
Even more confusing is that this property ShouldResetAfterResumeNotifications is false by default and we can't change it; so if it's false, why is Reset called anyway after ResumeNotifications()?
Thanks for your answer!
Indeed, the correct statement here is that calling the ResumeNotifications will always call CollectionChanged with Reset action.
Note that the ShouldResetAfterResumeNotifications property is True by default and there is no public API to change this. Here is how the property is initialized in the constructor of the RadObservableColleciton class.
public RadObservableCollection()
{
this.ShouldResetOnResumeNotifications = true;
}
To summarize this, you can change the property only through a reflection. Its purpose is to determine if the notifications will be resumed with a single Reset action, or with multiple Add/Remove actions. Because of the nature of WPF there is not much sense to use this, but it was requested and introduced back in the days. Changing this could cause a breaking change that we prefer to avoid. Anyway, we are going to update the documentation with information about the property.
That's strange then, because when I was debugging I saw that the value of this "ShouldReset" was false. Can it change at runtime on your side? Anyway, if it's not used for anything it doesn't really matter.
Thanks for the info!