I have the following XAML:
<Window x:Class="MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="0,0" Grid.Column="0" Background="Yellow" />
<TextBlock Text="1,0" Grid.Column="1" Background="SkyBlue" />
<GridSplitter Width="20" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Stretch" ShowsPreview="True" />
<TextBlock Text="3,0" Grid.Column="3" Grid.Row="0" />
</Grid>
</Window>
When there is only one ColumnDefinition
with a Width
of Auto
, the GridSplitter
works properly. However, once there are multiple columns with a Width
of Auto
, the first Auto
column also gets resized when the GridSplitter
is moved (can be seen in cell 1,0
).
Before resize:
After resize:
How can I prevent the GridSplitter from resizing the second column?
0,0
and3,0
columns? – StillResizeBehavior
don't seem to have any effect. – Alejandrinaalejandro