Random access…

Menu

Well, there are more than one person asked me the same question related to composite collection so I decided to copy the content from my old blog here
— OLD BLOG POST —
Couple days ago, one of the developer in my team came to me and asked for how to use the CompositionCollection in WPF. We can easily use that in XAML, the code will look something likes

But we need to support sorting, grouping…it turns out that what we really need here is a CollectionView on top of the composition collection. (We have been using the pattern called Model-View-ViewModel for a long time). So the solution is the use the same construct as the xaml code above but turn them into C#. The code will look something likes below