On this page, there is a note that states "If you use DataItemCollection as data source, the RadGridView will automatically synchronize the SortDescriptors of the source with its own ones." There is nothing describing how to instantiate a DataItemCollection, the constructor is internal, and there are very few examples of DataItemCollection ever being used, but it seems like it would help with my current scenario.
The reason for my wanting to use DataItemCollection came from a problem that I saw with maintaining selectability in the RadGridView. I have a class derived from ObservableCollection containing a property of type ListCollectionView, with SortDescriptions defined. The collection view is applied to the grid's ItemsSource. This is my problem scenario:
I had tried creating a custom KeyboardCommandProvider, where I set only the CommitEdit and SelectCurrentItem commands, but that didn't make a difference (the commit still causes the unwanted chain of events).
This all works as intended if I remove the SortDescriptions from the collection view but I need them. How can I resolve this? Would using a DataItemCollection instead of a ListCollectionView help me in any way?
I am using Q1 of the WPF controls (version 2011.1.419.40).
The reason for my wanting to use DataItemCollection came from a problem that I saw with maintaining selectability in the RadGridView. I have a class derived from ObservableCollection containing a property of type ListCollectionView, with SortDescriptions defined. The collection view is applied to the grid's ItemsSource. This is my problem scenario:
- I manually add a row to the grid view, through a button, by calling ListCollectionView.Add().
- I fill out the data in the cells and press enter.
- The CommitEdit() handling executes.
- Sorting is executed on the collection view.
- On the ListCollectionView.CurrentChanging event, the collection view has its CurrentItem set to the edited row item.
- On the ListCollectionView.CurrentChanged event, the collection view has its CurrentItem set to null!
I had tried creating a custom KeyboardCommandProvider, where I set only the CommitEdit and SelectCurrentItem commands, but that didn't make a difference (the commit still causes the unwanted chain of events).
This all works as intended if I remove the SortDescriptions from the collection view but I need them. How can I resolve this? Would using a DataItemCollection instead of a ListCollectionView help me in any way?
I am using Q1 of the WPF controls (version 2011.1.419.40).