HeaderPersister is a small utility class that persist the header of individual GroupItems while scrolling. It is not tied to any particular ItemsControl derived class, I confirmed a correct behavior for ListBox, ListView and TreeView.
The usage of the HeaderPersister is straightforward, make sure to:
- Bind to your
CollectionViewSourceinstance and define yourGroupDescriptionscollection. - Set the attached property
HeaderPersister.IsEnabledtotrue. - Duplicate the visual tree of the
GroupItemheader in theHeaderPersister.HeaderTemplateattached property.
For more information, check the following blog post: http://blog.qarim.net/2013/08/16/wpf-persistent-group-headers-for-the-listbox-control/
