Therefore, WPF does not support the standard sorting or filtering behavior for CompositeCollections, so it would be best practice to solve this problem.
There are two or more collections of objects of different types. You want to combine them into one sortable and filtered collection (if necessary, manually sort or filter).
One approach that I examined is to create a new collection of objects with several kernel properties, including the ones I would like to sort, and an instance of an object of each type.
class MyCompositeObject { enum ObjectType; DateTime CreatedDate; string SomeAttribute; myObjectType1 Obj1; myObjectType2 Obj2; { class MyCompositeObjects : List<MyCompositeObject> { }
And then scroll through my two object collections to put together a new composite collection. Obviously, this is a bit crude method, but it will work. I would get all the default sorting and filtering behavior in my new collection of compound objects, and I could place a data template on it to display list items correctly, depending on what type is actually stored in that compound element.
What suggestions exist for this in a more elegant way?
Christopher scott
source share