GridSplitter调整错误

时间:2013-02-21 10:30:45

标签: wpf resize grid splitter

Page派生类上,我有一些嵌套的网格。

我已将ColumnDefinition更改为某些像素的宽度(即大约5), 有些列的宽度为“*”。

所有元素都有Width="Auto"

这是我的分配器:

<Grid Margin="10"
          HorizontalAlignment="Stretch"
          VerticalAlignment="Stretch"
          Grid.Background="SpringGreen">

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="5" />
            <ColumnDefinition Width="5*" />
            <ColumnDefinition Width="5" />
            <ColumnDefinition Width="5" />
            <ColumnDefinition Width="5" />
            <ColumnDefinition Width="5*" />
            <ColumnDefinition Width="5" />

        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="5*" />

        </Grid.RowDefinitions>

        <GridSplitter Grid.Row="1"
                      Grid.Column="3"
                      Width="Auto"
                      Height="Auto"
                      Margin="0"
                      HorizontalAlignment="Stretch"
                      VerticalAlignment="Stretch"
                      Background="Red"
                      BorderThickness="1,0"
                      Cursor="SizeWE"
                      RenderTransformOrigin="-1,1"
                      ShowsPreview="True" />
    </Grid>

所以问题是,它几乎没有向左调整大小,而是向右调整。 它不依赖于窗口大小,即使在全屏幕中,分割器也只允许 左边的一些像素。

CNC中 有没有我发现自己的已知问题(在Google上)? 有没有人经历过类似的奇怪行为?

-edit update- 找到网格的最小定义以重现问题。

1 个答案:

答案 0 :(得分:2)

两个* -width列之间有3列宽度为5的列。 GridSplitter位于其中间。它的工作原理是调整前一列的大小(即5个像素列中的第一列)。您无法向左调整大小,因为该列的宽度仅为5像素。

请注意,RowColumn属性从零开始。