Home > DeveloperSection > Beginner > GridSpliter control in WPF

GridSpliter control in WPF


WPF WPF 
Ratings:
0 Comment(s)
 4685  View(s)
Rate this:

GridSpliter control in WPF

In this demonstration I am going to tell you that how to use GridSpliter control in WPF. The XAML <GridSpliter /> elements allow you to create a GridSpliter control. We can use GridSpliter control when we want to resize rows and columns dynamically.

XAML code snippet which represents GridSpliter control

<GridSplitter Background="Red" Grid.Column="1" ResizeDirection="Auto" Grid.Row="1" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />

 Some properties related With GridSpliter control

Ø  X: Name—x: Name property used to uniquely identify your controls.

Ø  ResizeDirection—ResizeDirection property is used to set direction of resigning of your control. ResizeDirection property has three values auto means both side, rows means only row should be resize and columns means only column can be resize.

Ø  HorizontalAlignment—HorizontalAlignment property is used to set horizontal alignment of your GridSpliter control.

Ø  VerticalAlignment—VerticalAlignment property is used to set vertical alignment of your GridSpliter control.

Ø  Width—Width property is used to set width of the GridSpliter control.

Ø  Height—Height property is used to set Height of the GridSpliter control.

The following xaml code snippets represent use of GridSpliter control

<Grid>

        <Grid.RowDefinitions>

            <RowDefinition />

        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>

            <ColumnDefinition Width="120" />

            <ColumnDefinition Width="3"/>

            <ColumnDefinition />

        </Grid.ColumnDefinitions>

        <Grid Grid.Column="0" Background="Goldenrod" />

        <GridSplitter Background="Red" Grid.Column="1" ResizeDirection="Auto" Grid.Row="1" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />

        <Grid Grid.Column="2" Background="RosyBrown" />

</Grid>

Output of the following code snippet is as follows

GridSpliter control in WPF

GridSpliter control in WPF

 


Don't want to miss updates? Please click the below button!

Follow MindStick