tags:

views:

501

answers:

1

It seems that the final width(or height) passed in to ArrangeOverride method is never less than the desired width (or height) returned from the MeasureOverride method.

Is this always true?

+1  A: 

I believe you can assume that the final size passed in will be less than or equal to the desired size, but not always the exact size. Arrange is after it decides the actual dimensions things will be, so it will generally be actual values (as opposed to Measure where +Inf is common)

Paul Betts
To me it looks like the final size passed into ArrangeOverride is based on what I return in MeasureOverride. If I return a bogus value (e.g. height of 10,000), that gets passed to ArrangeOverride, even tough my app. window height is only a few hundered pixels.
It depends on the container your panel was in - if you're in a ScrollViewer for example, it's going to give you all the room you want.
Paul Betts
As Paul says, the container makes a difference. I experienced the same issue as in the question. Then I replaced the container from StackPanel to Grid, and suddenly ArrangeOverride started to behave as expected.
ROWLEX Admin