I have pretty simple layout, look:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="200"></ColumnDefinition>
<ColumnDefinition Width="5"></ColumnDefinition>
<ColumnDefinition Width="Auto" MinWidth="50"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border Grid.Column="0"
BorderBrush="Red"
BorderThickness="2">
<!-- Any picture-->
<Image Source="/Resources/PreviewTest.png"></Image>
</Border>
<GridSplitter Grid.Column="1"
Width="5"
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
ResizeBehavior="PreviousAndNext"></GridSplitter>
<Expander Grid.Column="2"
ExpandDirection="Left"
BorderBrush="RoyalBlue"
BorderThickness="2">
<!-- Any picture-->
<Image Source="/Resources/PreviewTest.png"></Image>
</Expander>
</Grid>
The problem: when I'm dragging GridSplitter
to left, right column goes out from window border as shown on animation. I found that it happens when width of third column is set as "Auto" (Width="Auto"
). If I set Width="*"
GridSplitter
works fine and third Column
doesn't go out from window border. So why when Width="Auto"
it happens?