ListBox Grouping and Virtualization

Update IOuterPanel.EstimatedViewport during MeasureOverride()

groupingpanelmeasureoverride.png

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.

Explore posts in the same categories: WPF

Pages: 1 2 3 4 5 6 7

Tags: , , , , ,

You can comment below, or link to this permanent URL from your own site.

One Comment on “ListBox Grouping and Virtualization”

  1. Luke Says:

    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.


Comment:

You must be logged in to post a comment.