Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
[StyleTypedPropertyAttribute(Property="PreviewStyle", StyleTargetType=typeof(Control))] public class GridSplitter : Thumb
/** @attribute StyleTypedPropertyAttribute(Property="PreviewStyle", StyleTargetType=System.Windows.Controls.Control) */ public class GridSplitter extends Thumb
StyleTypedPropertyAttribute(Property="PreviewStyle", StyleTargetType=System.Windows.Controls.Control) public class GridSplitter extends Thumb
The GridSplitter control redistributes space between rows or columns in a Grid, without changing the dimensions of the Grid. For example, when a GridSplitter resizes two columns, the ActualWidth property of one column is increased while at the same time the ActualWidth property of the other column is decreased by the same amount.
The following table shows how to define a horizontal or vertical GridSplitter by setting the HorizontalAlignment and VerticalAlignment properties and by leaving the ResizeDirection and ResizeBehavior properties set to their default values.
How to create vertical and horizontal GridSplitter controls
If ActualHeight is less than ActualWidth,this resizes the columns (vertical).
A GridSplitter can overlap a row or column that contains other content, or can occupy a row or column by itself. For more information about how to define a GridSplitter, see How to: Resize Rows with a GridSplitter and How to: Resize Columns with a GridSplitter.
If the HorizontalAlignment and VerticalAlignment property settings do not achieve the desired GridSplitter behavior, you can change the ResizeDirection and ResizeBehavior property settings.
A GridSplitter may be obscured by other objects that are contained in the Children collection of the Grid. For information about how to prevent this situation, see How to: Make sure that a GridSplitter is Visible.
The following example shows how to define a GridSplitter that resizes columns in a Grid by overlaying the edge of a column.
<Grid> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <GridSplitter Grid.Column ="0" Background="Blue" HorizontalAlignment="Right" VerticalAlignment="Stretch"/> </Grid>
GridSplitter mySimpleGridSplitter = new GridSplitter(); Grid.SetColumn(mySimpleGridSplitter, 0); mySimpleGridSplitter.Background = Brushes.Blue; mySimpleGridSplitter.HorizontalAlignment = HorizontalAlignment.Right; mySimpleGridSplitter.VerticalAlignment = VerticalAlignment.Stretch; mySimpleGridSplitter.Width = 5;
The following example shows how to define a GridSplitter that resizes columns in a Grid and that occupies a column in the Grid.
<Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition Width="Auto" /> <ColumnDefinition/> </Grid.ColumnDefinitions> ... <GridSplitter Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" Background="Black" ShowsPreview="True" Width="5" />
|How to: Resize Rows with a GridSplitter|| |
This example shows how to use a horizontal GridSplitter to redistribute the space between two rows in a Grid without changing the dimensions of the Grid.
|How to: Resize Columns with a GridSplitter|| |
This example shows how to create a vertical GridSplitter in order to redistribute the space between two columns in a Grid without changing the dimensions of the Grid.
|How to: Make Sure That a GridSplitter Is Visible|| |
This example shows how to make sure a GridSplitter control is not hidden by the other controls in a Grid.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.