开发者

Filling In GroupBox

I have a groupbox that contains nested stack panels that aren't filling in the groupbox entirely. I would like to have all the stackpanels evenly spaced out filling in the entire groupbox. I have attempted changing the VerticalContentAlignment to Stretch for the groupbox, but that does not work.

<GroupBox>
        <StackPanel>
            <StackPanel Orientation="Horizontal">
                <Label Content="Test1" />
                <Label Content="Test2"/>        
            </StackPanel>

            <StackPanel Orientation="Horizontal">
                <Label Content="Test3" 开发者_Python百科/>
                <Label Content="Test4"/>
            </StackPanel>
        </StackPanel>
</GroupBox


StackPanels by default only use as much space as is required to display whatever they contain. If you need different behavior you either need to roll your own version of a stackpanel or use another container. Both Grids/Dockpanels work fine as substitutes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜