none
how to split the window in WPF ?

Answers

  • Hi CheckingPoint,

    I believe you may use the GridSplitter Control to achieve this. Please, check the following links for more help:

    1. http://codebetter.com/stevehebert/2008/04/16/creating-a-horizontal-gridsplitter-for-real/

    2. http://www.wpftutorials.com/2011/03/wpf-gridsplitter.html

    I hope this helps.


    Please, mark my reply as Answer if it helps or vote it up if it gives a key to the solution.
    Thanks in advance and good luck.
    Ahmed M. Gamil
    "It is not titles that honor men, but men that honor titles."
    Monday, December 05, 2011 9:47 AM
  • Are you looking for the use of a GridSplitter, then i would advise either of the links provided by Gamil. 

    If you are merely looking for dividing the Window, you can use either Grid.ColumnDefinition or Grid.RowDefinitions, which can be used like this.

    <Window x:Class="WpfApplication4.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/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            
            <Label Content="Part1" 
                   Grid.Column="0"
                   Grid.Row="0"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center"
                   FontSize="30"/>
    
            <Label Content="Part2" 
                   Grid.Column="1"
                   Grid.Row="0"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center"
                   FontSize="30"/>
    
            <Label Content="Part3" 
                   Grid.Column="0"
                   Grid.Row="1"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center"
                   FontSize="30"/>
    
            <Label Content="Part4" 
                   Grid.Column="1"
                   Grid.Row="1"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center"
                   FontSize="30"/>
        </Grid>
    </Window>
    
    

    Good luck !


    Developing is part of being a developer.
    Monday, December 05, 2011 10:12 AM

All replies

  • Hi CheckingPoint,

    I believe you may use the GridSplitter Control to achieve this. Please, check the following links for more help:

    1. http://codebetter.com/stevehebert/2008/04/16/creating-a-horizontal-gridsplitter-for-real/

    2. http://www.wpftutorials.com/2011/03/wpf-gridsplitter.html

    I hope this helps.


    Please, mark my reply as Answer if it helps or vote it up if it gives a key to the solution.
    Thanks in advance and good luck.
    Ahmed M. Gamil
    "It is not titles that honor men, but men that honor titles."
    Monday, December 05, 2011 9:47 AM
  • Are you looking for the use of a GridSplitter, then i would advise either of the links provided by Gamil. 

    If you are merely looking for dividing the Window, you can use either Grid.ColumnDefinition or Grid.RowDefinitions, which can be used like this.

    <Window x:Class="WpfApplication4.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/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            
            <Label Content="Part1" 
                   Grid.Column="0"
                   Grid.Row="0"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center"
                   FontSize="30"/>
    
            <Label Content="Part2" 
                   Grid.Column="1"
                   Grid.Row="0"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center"
                   FontSize="30"/>
    
            <Label Content="Part3" 
                   Grid.Column="0"
                   Grid.Row="1"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center"
                   FontSize="30"/>
    
            <Label Content="Part4" 
                   Grid.Column="1"
                   Grid.Row="1"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center"
                   FontSize="30"/>
        </Grid>
    </Window>
    
    

    Good luck !


    Developing is part of being a developer.
    Monday, December 05, 2011 10:12 AM
  • Hi checkingpoint,

    Thank you for your post.

    What Gamil said is good, and SharpAspirant gives an other way.

    Do you have resolved your issue as what they said?

    If you have any additional questions, please feel free to let me know.

    Have a nice day. 


    Annabella Luo[MSFT]
    MSDN Community Support | Feedback to us
    Tuesday, December 06, 2011 5:01 PM
    Moderator