Alternative for CollectionViewSource.GetDefaultView
Posted: 24 Dec 2020, 09:27
I was using this outside of NoesisGUI to set up a custom sort in a view model:
_groupMembers is an ObservableCollection<> of my GUI elements. I'm making sure they are ordered a certain way based on the view model data represented by the elements.
I thought this was kind of a goofy thing to do, but I do need to code the sorting logic; it's not a simple field based sort. NoesisGUI seems to know what a CollectionViewSource is but doesn't result GetDefaultView(). I also couldn't resolve ListCollectionView at all.
Should I be doing something else to be compatible with NoesisGUI?
Code: Select all
protected void setUpSaveButtonSorting()
{
var view = (ListCollectionView)CollectionViewSource.GetDefaultView(_groupMembers);
view.CustomSort = new CommonSaveButtonDataComparer();
}
I thought this was kind of a goofy thing to do, but I do need to code the sorting logic; it's not a simple field based sort. NoesisGUI seems to know what a CollectionViewSource is but doesn't result GetDefaultView(). I also couldn't resolve ListCollectionView at all.
Should I be doing something else to be compatible with NoesisGUI?