I made some digging, and found out that there are folks that are interested what is this interface doing (along with some other interesting interfaces...)
MSDN says nothing about this interface, but it turned out that it could be quite useful in fact.
Here is how it is declared:
///
public interface ICollectionViewFactory
{
///
///
ICollectionView CreateView();
}
It turned out that when you try to create a default collection view for the collection(or when you provide your collection as an items source for the ItemsControl), databinding engine checks whether your collection implements ICollectionViewFactory interface, and if it does - your CreateView() method is called, so in case you want to implement some specific logic, like optimized grouping, or specific filtering - you just implement your own collection view and return it in CreateView() method.
2 comments:
Thanks for this post!
Just what I was looking for - a way to provide my custom collection view as the default view for my collections!
Yeah, that's exactly what I thought, only when I tried this out it doesn't work - for some reason my CreateView() function isn't getting called. Weird?
Post a Comment