WPF vertical strainer does not work

I have a vertical grid, but instead I get a horizontal one. 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> 

enter image description here

in the grid, I have a stack panel, a data grid and some text fields. Any idea why I have the wrong behavior?

+6
source share
2 answers

Try adding additional properties, such as

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

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

+17
source

Your XAML is not working. Please fix this.

In any case, I took some of your code and made some minor changes, so it compiled, and I get a vertical separator:

 <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"/> <Button Grid.Column="2">Test column 2</Button> </Grid> 
+1
source

Source: https://habr.com/ru/post/987421/


All Articles