Matthew
Matthew

Reputation: 29206

Why isn't my GridSplitter showing up?

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.

What am I doing wrong?

Upvotes: 4

Views: 464

Answers (1)

CodeNaked
CodeNaked

Reputation: 41393

You need to set HorizontalAlignment="Stretch":

<GridSplitter Grid.Row="1" Background="Black" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="5" />

Upvotes: 6

Related Questions