Reputation: 29206
I have a simple Window
that looks like this:
<Window x:Class="StackOverflowExample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="3*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<Label Content="Foo" Margin="5" />
<Label Grid.Row="1" Content="Bar" Margin="5" />
<GridSplitter Grid.Row="1" Background="Black" VerticalAlignment="Top" Height="5" />
</Grid>
</Window>
// The code-behind is empty, except for "InitializeComponent()".
When I run the application, however, no GridSplitter
is visible. I also see no GridSplitter
during design time.
GridSplitter
is in the correct row, and set the VerticalAlignment
to Top
GridSplitter
does not blend in.GridSplitter
is the last element in the Grid
, so I shouldn't be running into ZIndex
problems.What am I doing wrong?
Upvotes: 4
Views: 464
Reputation: 41393
You need to set HorizontalAlignment="Stretch"
:
<GridSplitter Grid.Row="1" Background="Black" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="5" />
Upvotes: 6