WPF垂直网格拆分器不起作用 [英] WPF vertical gridsplitter not working

查看:90
本文介绍了WPF垂直网格拆分器不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个垂直的网格分割器,但是我得到了一个水平的网格分割器. 这是我的XAML

I have a vertical gridsplitter, but I get an horizontal one instead. here is my XAML

<GroupBox Header="Phase Management">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="5"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="70*"/>
                <RowDefinition Height="30*"/>
            </Grid.RowDefinitions>

            <Button>Test column 0</Button>

            <GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" Background="#FFFFFF" ResizeBehavior="PreviousAndNext"/>

            <Button Grid.Column="2">Test column 2</Button>

        </Grid>
    </GroupBox>

在网格中,我有一个堆栈面板,一个数据网格和一些文本框. 知道为什么我会有错误的行为吗?

in the grid I have a stack panel, a data grid and some text boxes. Any idea of why I'm having the wrong behavior?

推荐答案

尝试添加其他属性,例如

Try to add additional properties like

<GridSplitter Grid.Column="1"
              ResizeDirection="Columns"
              ResizeBehavior="PreviousAndNext"
              HorizontalAlignment="Stretch"/>

表示方向(在您的情况下为列")和行为(在示例中为左右两个方向调整大小).

for the direction (in your case "Columns") and for the behavior (in the example for resizing in both directions, left and right).

这篇关于WPF垂直网格拆分器不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆