WPF grid layout

Is it possible to create something like this using Grid in WPF? Constructive columns are simple, but what about rows? Or is there a better solution, like another container? Imagine each rectangle as a module (GroupBox).

Grid layout

+4
source share
2 answers

Make an external grid with two columns. Inside this grid, place two other grids, one per column. This will result in the desired design.

Here is an example of how to do this. Please note that I placed several stars at the heights. Change them to suit your needs.

<Grid> <Grid.ColumnDefinitions> <Grid.ColumnDefinition Width="*" /> <Grid.ColumnDefinition Width="*" /> <Grid.ColumnDefinitions> <Grid Grid.Column="0"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <!-- Here content elements of the first column --> </Grid> <Grid Grid.Column="1"> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <!-- Here content elements of the second column --> </Grid> </Grid> 
+5
source

Define your columns and rows. Place each Groupbox in the desired row and column and set its rowspan to determine how many rows it stretches.

0
source

All Articles