articles

Home / DeveloperSection / Articles / GridSpliter control in WPF

GridSpliter control in WPF

Anonymous User9183 05-Apr-2011

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

 


Updated 07-Sep-2019
I am a content writter !

Leave Comment

Comments

Liked By