I'm binding a XamDataGrid DataSource to the ICollectionView of an ObservableCollection in my ViewModel. When I remove the CurrentItem of the ICollectionView from the ObservableCollection in the ViewModel, I would like the CurrentItem to select the next object in the ObservableCollection as it appears to the user. If the user performs sorting or grouping on the XamDataGrid, the selection appears to jump around randomly when I remove the CurrentItem from the ObservableCollection, because the "next" item of the ObservableCollection corresponds to the order in which the objects were added to the ObservableCollection, not the order the objects are rendered on the screen inside the XamDataGrid (because of sorting and / or grouping).
I've tried subscribing to my XamDataGrid's Sorting and Grouping events, and populating the ICollectionView's SortDescriptions and GroupDescriptions properties in the event handlers, which seems to synchronize the XamDataGrid with the ObservableCollection, but this seems like it shouldn't be necessary.
Is the XamDataGrid capable of populating my ICollectionView SortDescriptions and GroupDescriptions properties directly, without the need for subscribing to these events? Is there another way of "synchronizing" the order of objects in my ObservableCollection?
Hello,
It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking through your post and it seems like that the ICollectionView doesn’t synchronize with the XamDataGrid’s SortDescriptions and GroupByDescriptions. If you want you can explicitly add the Descriptions from the XamDataGrid to the ColectionView on Grouped and Sorted events.
Feel free to write me if you have further questions.
Hi,
In case anyone else is running into this issue, here's the latest: I ended up creating a support issue for this, that was eventually denied by Infragistics. I'm aware that I can write event handlers to synchronize the SortDescriptions and GroupByDescriptions of the ICollectionView myself.
The point of this post, and my support issue, is that I feel that it is unreasonable for Infragistics to expect consumers of XamDataGrid to have to do so.
When binding to an ICollectionView, It would seem that XamDataGrid uses some mechanism other than the ICollectionView to keep track of sorting and grouping. Infragistics should either support binding to an ICollectionView or not, but if it is supported, the entire interface should be supported, including these two collections.
Is XamDataGrid MVVM compatible using ICollectionView? That depends on how much of ICollectionView you care about, and whether you're willing to maintain code to work around inconsistencies in XamDataGrid's implementation.
After some research, Synchronize SortDescriptions and GroupByDescriptions with ICollectionView has been determined to be a new feature request. I have sent your feature request directly to our product management team. Our product team chooses new feature requests for development based on popular feedback from our customer base. Infragistics continues to monitor application development for all of our products, so as trends appear in requested features, we can plan accordingly.
We value your input, and our philosophy is to enhance our toolset based on customer feedback. If your feature is chosen for development, you will be notified at that time. Your reference number for this feature request is FR13557.
If you would like to follow up on your feature request at a later point, you may contact Developer Support management via email. Please include the reference number of your feature request in the subject and body of your email message. You can reach Developer Support management through the following email address: dsmanager@infragistics.com