I feel bad about not getting this.
But, although I have read several articles on measure pass and arrange pass and written several small programs, I still have a hard time with this.
It makes sense to me that any user control will have a “minimum size” (after which only possible solution would be to shrink it as a whole bitmap wise or add a scroll bar). It will also have a way to use any additional screen real estate given to it.
Ellipses have no minimum size and can collapse to size zero.
So, consider this example
<Grid>
<StackPanel Orientation="Horizontal" Height="20">
<Ellipse Fill="Blue"/>
<Ellipse Fill="Green"/>
<Ellipse Fill="BlueViolet"/>
</StackPanel>
</Grid>
what is the least amount of xaml code needed to add to achieve the following effects:
- Make them force a “minimum size” of uniform 40. And dynamically resize uniformly.
- Make them force a “minimum size” of uniform 40. And dynamically resize non-uniformly (so that the they can stretch really wide, but will never size below 40/40).
- Make them force a minimum height, but stretch to available width.
- Make them stretch uniformly fitting a constant height of the stackpanel.
- Make the stackpanel stretch to fill the dynamic height of its container.
Thank you.
In most of those cases you probably want to use a
UniformGridwith one column instead of aStackPanel. To force sizes use aStylewhich sets theMinHeightandMinWidth. If the uniformity is guaranteed to be “one-way” you can just bind theWidthto theActualHeight.