ListBox Grouping and Virtualization
Update IOuterPanel.EstimatedViewport during MeasureOverride()

In MeasureOverride() for IOuterPanel, remember that the size that is passed in represents the viewport, so you need to update IOuterPanel.EstimatedViewport before you measure any child elements. This will ensure that when INestedPanel’s MeasureOverride() is called, it can query IOuterPanel for the viewport dimensions, and the scroll offset(s) to realize/unrealize children as necessary.
Note: When MeasureOverride() is called in your INestedPanel, you must calculate and return the extent as the desired size. Remember, IOuterPanel is the one controlling scrolling, so doing this will prevent your scroll range from becoming messed up.
This entry was posted on February 22, 2008 at 9:04 pm and is filed under WPF. You can subscribe via RSS 2.0 feed to this post's comments.
Tags: grouping, lazy-loading, ListBox, panel, scrolling, virtualizing
You can comment below, or link to this permanent URL from your own site.
July 9, 2009 at 11:10 am
Great blog post! Can you please provide more details how you reworked your solution to support sorting? I am having trouble with virtualization when grouping is enabled and can’t seem to solve this issue.