Loading...
Loading...
Guide for implementing Syncfusion WPF GridSplitter (SfGridSplitter) control for dynamic layout resizing. Use this skill when implementing WPF GridSplitter, split panels, or resizable grid layouts. Covers splitting grid rows or columns with movable splitters, collapse/expand functionality, resizable panels, drag behavior configuration, and splitter appearance customization in WPF applications.
npx skill4agent add syncfusion/wpf-ui-components-skills syncfusion-wpf-gridsplitter<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Top Panel -->
<Border Grid.Row="0" Background="LightBlue">
<TextBlock Text="Top Panel"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Border>
<!-- Grid Splitter -->
<syncfusion:SfGridSplitter Grid.Row="1"
HorizontalAlignment="Stretch"
Height="5"
Background="DarkGray"
ResizeBehavior="PreviousAndNext"/>
<!-- Bottom Panel -->
<Border Grid.Row="2" Background="LightGreen">
<TextBlock Text="Bottom Panel"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Border>
</Grid>
</Window><Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- Left Panel -->
<Border Grid.Column="0" Background="LightCoral">
<TextBlock Text="Left Panel"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Border>
<!-- Grid Splitter -->
<syncfusion:SfGridSplitter Grid.Column="1"
VerticalAlignment="Stretch"
Width="5"
Background="DarkGray"
ResizeBehavior="PreviousAndNext"/>
<!-- Right Panel -->
<Border Grid.Column="2" Background="LightYellow">
<TextBlock Text="Right Panel"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Border>
</Grid><syncfusion:SfGridSplitter Grid.Row="1"
HorizontalAlignment="Stretch"
Height="8"
EnableCollapseButton="True"
ResizeBehavior="PreviousAndNext"/><syncfusion:SfGridSplitter Grid.Row="1"
HorizontalAlignment="Stretch"
ShowsPreview="True"
ResizeBehavior="PreviousAndNext"/>// Move splitter by 50 pixels
gridSplitter.MoveSplitter(50);
// Move splitter by -30 pixels (opposite direction)
gridSplitter.MoveSplitter(-30);<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!-- Panels in different grid positions -->
<Border Grid.Row="0" Grid.Column="0" Background="LightBlue"/>
<Border Grid.Row="2" Grid.Column="0" Background="LightGreen"/>
<Border Grid.Row="0" Grid.Column="2" Grid.RowSpan="3" Background="LightYellow"/>
<!-- Horizontal Splitter -->
<syncfusion:SfGridSplitter Grid.Row="1" Grid.Column="0"
HorizontalAlignment="Stretch"
ResizeBehavior="PreviousAndNext"/>
<!-- Vertical Splitter -->
<syncfusion:SfGridSplitter Grid.RowSpan="3" Grid.Column="1"
VerticalAlignment="Stretch"
ResizeBehavior="PreviousAndNext"/>
</Grid><syncfusion:SfGridSplitter DragIncrement="10"
KeyboardIncrement="20"
HorizontalAlignment="Stretch"
ResizeBehavior="PreviousAndNext"/>| Property | Type | Purpose | When to Use |
|---|---|---|---|
| ResizeBehavior | ResizeBehavior | Controls which rows/columns are affected by resize | Set to PreviousAndNext (most common), PreviousAndCurrent, or CurrentAndNext based on which panels should resize |
| EnableCollapseButton | bool | Shows/hides collapse/expand buttons | Enable when users need to temporarily hide panels |
| ShowsPreview | bool | Shows resize preview before applying | Enable for heavy layouts or when users need visual confirmation |
| DragIncrement | double | Pixel interval for mouse-based resizing | Set to constrain resize to specific increments (default: 1) |
| KeyboardIncrement | double | Pixel interval for keyboard-based resizing | Set for arrow key resize granularity (default: 20) |
| HorizontalAlignment | HorizontalAlignment | Alignment for horizontal splitters | Use Stretch for row resizing |
| VerticalAlignment | VerticalAlignment | Alignment for vertical splitters | Use Stretch for column resizing |
| Background | Brush | Splitter bar color | Customize to match application theme |
| Height | double | Height of horizontal splitter bar | Set explicit height (e.g., 5-10 pixels) for horizontal splitters |
| Width | double | Width of vertical splitter bar | Set explicit width (e.g., 5-10 pixels) for vertical splitters |