Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF: Something standard and similar to the `SplitContainer`?

Tags:

c#

wpf

Is there something standard and similar to the Windows Forms SplitContainer in WPF?

I'm a bit lost with Grids because controls seem not to be inside the cells but over them :s.

I did some googling but I don't know exactly what to write in the search field...

like image 788
Jaime Oro Avatar asked Feb 14 '11 12:02

Jaime Oro


2 Answers

Sample of how to make an Horizontal SplitContainer using a Grid and a GridSplitter like SnowBear said:

<Window x:Class="JobFinder1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="JobFinder1" Height="350" Width="525" AllowsTransparency="False">
    <Grid Name="gridMain">
        <Grid.RowDefinitions>
            <RowDefinition Height="26" />
            <RowDefinition />
            <RowDefinition Height="1"/>
            <RowDefinition />
        </Grid.RowDefinitions>

        <ToolBar Height="26" VerticalAlignment="Stretch" HorizontalAlignment="Left" />
        <ListView Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
        <GridSplitter Background="DarkGray"  ResizeDirection="Rows" Grid.Row="2" 
                      HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
                      ResizeBehavior="PreviousAndNext" />
        <ListView Grid.Row="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
    </Grid>
</Window>
like image 91
Jaime Oro Avatar answered Sep 30 '22 02:09

Jaime Oro


Grid + GridSplitter at your service

like image 26
Snowbear Avatar answered Sep 30 '22 01:09

Snowbear