Reputation: 4691
I have a GridSplitter
but I can't make it stretch the full height of my app (my UserControl
to be more precise). It only fills the same height as the content on the left/right of the GridSplitter
.
<Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="*" /> <!--this was a trial and error thing-->
</Grid.RowDefinitions>
<Grid Grid.Row="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" MinWidth="150" />
<ColumnDefinition Width="2" />
<ColumnDefinition Width="8*" MinWidth="250" />
</Grid.ColumnDefinitions>
<TextBlock Text="left" Grid.Column="0"/>
<GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" />
<TextBlock Text="right" Grid.Column="2"/>
</Grid>
</Grid>
</Grid>
As I don't know the height, I was hoping for
This works in that the height is bigger, but it's not an acceptable approach as I don't know the size of the clients monitor.
But that isn't valid.
What do I need to do?
This is the parent
<StackPanel Grid.Row="1" Background="Orange">
<ContentPresenter Content="{Binding Vm}" />
</StackPanel>
As you can see the background is orange, this gives me the bounds of the control. The control takes up all the room it can.
Upvotes: 1
Views: 40
Reputation: 10744
Change the StackPanel
parent to a Grid
control. The StackPanel
control will size to its child elements. Use a Grid
control instead, which will size to its parent control.
<Grid Grid.Row="1" Background="Orange">
<ContentPresenter Content="{Binding Vm}" />
</Grid>
Upvotes: 1