简体   繁体   中英

Does resizing a control in WPF resize its StackPanel?

I have a Canvas inside of a StackPanel in my WPF Designer in Visual Studio 2008. At runtime I plan to resize the Canvas so its client rect is a certain size (borders and other parts are just added onto that size). When I resize the Canvas, will the Width/Height of the StackPanel adjust itself accordingly? This is important since I have other controls that align themselves based on the size of the stack panel.

The size of the stack panel is dependent upon the cumulative sizes of the controls (plus margins) that live inside the stack panel.

So if your controls add up to 100px high, then the stack panel is only ever going to be 100px high.

实际上,一种替代选择是使用网格来调整大小,同时根据需要定义列/行。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM