Mare Infinitus
Mare Infinitus

Reputation: 8192

GridSplitter resizes incorrectly

On a Page derived class, I have some nested Grids.

I have changed the ColumnDefinition to the width of some pixels (i.e. around 5), with some columns having the width of "*".

All elements have Width="Auto".

Here is my Splitter:

<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>

So the problem is, it does almost no resizing to the left, but very much to the right. It is not depending on the window size, even in fullscreen, the splitter only allows some pixels to the left.

-edit- Are there any known problems that I did not find myself (on Google)? Anyone experienced similar strange behaviour?

-edit update- Found a minimum definition for the grid to reproduce the problem.

Upvotes: 0

Views: 944

Answers (1)

Tim Rogers
Tim Rogers

Reputation: 21723

You have 3 columns of width 5 between the two *-width columns. The GridSplitter is in the middle of these. It works by resizing the preceding column (i.e. the first of your 5 pixel columns). You can't resize to the left because that column is only 5 pixels wide.

Remember that Row and Column properties are zero-based.

Upvotes: 2

Related Questions