my items in custom panel doesn’t change their size, just clips.
I have panel sized to 400px height and listbox in it full of items (with scrollbar).
I would like to make that child to take only half of my panel’s height like this in ArrangeOverride:
Children.Single().Arrange(
new Rect(0, 0, child.DesiredSize.Width, finalSize.Height / 2));
At first it looks like that it worked well, but for real listbox’s size didn’t change its still 400px, but only top 200px are visible – it got clipped instead of resized.
I got more complicated panel but all items in it gets clipped. Any hints what’s wrong?
When creating custom panel it’s Children size must be calculated in MeasureOverride method not in Arrange. Moving code from ArrangeOverride to MeasureOverride with some minor tweaks forced custom panel to function as intended.
Second parameter for Arrange must be not less than DesiredSize calculated in MeasureOverride method. If not – item will get clipped.