Hi,Could you please help me with XamGrid.InvalidateData ?I have Hierarchical grid:RootItem1 - Sub Items... <-- I can set GroupBy to those.RootItem2....I'm raising xamGrid.InvalidateData(true) when grid viewModel updates - but this procedure also is resetting groups collapse/expand state in all items.Is there a way to InvalidateData on subitems of only specific RootItemX node (expecting that groups in other RootItems would preserve correct state)?
Hi Nikita,
InvalidateData only exists on the XamGrid itself so there's no way to use it on just a sub section of rows instead. And that method causes sorting and groupby operations to be invalidated which is why the expansion state is lost when you call this.
Is it really necessary to call InvalidateData when your view model updates? What kind of view model update are you performing that requires the InvalidateData method? INotifyPropertyChanged and INotifyCollectionChanged are fully supported by the control so there's usually no reason to call that method if you need to update the XamGrid to show changes in the underlying data.
Thanks Rob,
I just tried few things:1. rootItem.SubItems = new ObservableCollection <- this work but grid has a bug - column headers and group rows removed from grid and headers only on specific actions (like removing groups from group area).2. rootItem.SubItems.RaiseResetColllection <- this works perfectly - XamGrid updates only specific rootItem (To do this i overrided default ObservableCollection and added RaiseResetColllection method which raises INotifiyCollectionChanged event)
I'll look into #1. I'm not positive that this is a bug as I would expect certain things to be lost if you replace the SubItems collection like that. Generally #2 is a better option as it doesn't remove or replace any data, but just triggers a reset which the XamGrid will react to.
I'll get back to you shortly about #1.
I believe I have reproduced the issue you saw in #1. If I have some child data grouped and then I replace the SubItems instance, the child headers and groupings are gone. This doesn't look correct so I have logged a development issue for this. The issue ID is 217694. I have also created a private support case for you so that you can track the status of the dev issue. The case number is CAS-171802-M2N4P3 and you can view it here.
As mentioned before though, it would be best to not replace the entire instance anyway and just raise the collection reset event if you need to trigger some update.
Thanks RobYes, i'm using raise collection reset event and this works perfect. I tried collection instance replacing just because it was easier at my situation, but reset event way is fine by me.