Well, talking to other people offline, here is the best from my understanding:
In case you want to make a more complex layout using LayoutTransform or RenderTransform, thereby adding indirection between passing the control measure / organization and the actual borders of the pixels that appear inside, the message behavior of all the controls that they can use as much space as they want, reasonably, because you're just trying to execute a layout on a surface that is separate from the actual cropped area on the screen.
It still seems like it falls into the category of “if you wrap the StackPanel in something scrollable ...”, but admittedly it’s not clear that in my proposed version the available size should be after you start messing with RenderTransform for StackPanel. (Although this is more fundamental than this, RenderTransform doesn’t “play perfectly” with MeasureOverride in design because it is designed separately from the layout engine for performance ... so it’s still not clear, this is a great argument.)
In any case, the way to get the StackPanel to behave when some selected element consumes the remainder that is not used by other elements is to use the DockPanel, insert fixed size elements into the StackPanels above or below and dynamically resize either above or below or in the middle between two stacks.
I believe that if I needed several elements that consume available space in a proportional way, then what is the grid for?
But I have to say that I still do not understand, from a fundamental point of view, why the StackPanel passes Infinity down to orient its children towards the call to MeasureOverride; I see no argument for why you did not pass the actual remaining unclaimed available size passed in by the StackPanel parent, and a few arguments for why you did it.
source share