Loading...
Loading...
Compare original and translation side by side
<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><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>
<!-- 顶部面板 -->
<Border Grid.Row="0" Background="LightBlue">
<TextBlock Text="Top Panel"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Border>
<!-- 网格拆分器 -->
<syncfusion:SfGridSplitter Grid.Row="1"
HorizontalAlignment="Stretch"
Height="5"
Background="DarkGray"
ResizeBehavior="PreviousAndNext"/>
<!-- 底部面板 -->
<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><Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- 左侧面板 -->
<Border Grid.Column="0" Background="LightCoral">
<TextBlock Text="Left Panel"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Border>
<!-- 网格拆分器 -->
<syncfusion:SfGridSplitter Grid.Column="1"
VerticalAlignment="Stretch"
Width="5"
Background="DarkGray"
ResizeBehavior="PreviousAndNext"/>
<!-- 右侧面板 -->
<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"
Height="8"
EnableCollapseButton="True"
ResizeBehavior="PreviousAndNext"/><syncfusion:SfGridSplitter Grid.Row="1"
HorizontalAlignment="Stretch"
ShowsPreview="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);// 将拆分器移动50像素
gridSplitter.MoveSplitter(50);
// 将拆分器反向移动30像素
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><Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!-- 不同网格位置的面板 -->
<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"/>
<!-- 水平拆分器 -->
<syncfusion:SfGridSplitter Grid.Row="1" Grid.Column="0"
HorizontalAlignment="Stretch"
ResizeBehavior="PreviousAndNext"/>
<!-- 垂直拆分器 -->
<syncfusion:SfGridSplitter Grid.RowSpan="3" Grid.Column="1"
VerticalAlignment="Stretch"
ResizeBehavior="PreviousAndNext"/>
</Grid><syncfusion:SfGridSplitter DragIncrement="10"
KeyboardIncrement="20"
HorizontalAlignment="Stretch"
ResizeBehavior="PreviousAndNext"/><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 |
| 属性 | 类型 | 用途 | 适用场景 |
|---|---|---|---|
| ResizeBehavior | ResizeBehavior | 控制调整大小影响的行/列 | 根据需要调整的面板,设置为PreviousAndNext(最常用)、PreviousAndCurrent或CurrentAndNext |
| EnableCollapseButton | bool | 显示/隐藏折叠/展开按钮 | 当用户需要临时隐藏面板时启用 |
| ShowsPreview | bool | 在应用调整前显示预览效果 | 针对复杂布局或用户需要视觉确认时启用 |
| DragIncrement | double | 鼠标调整大小的像素间隔 | 设置为特定增量以限制调整粒度(默认值:1) |
| KeyboardIncrement | double | 键盘调整大小的像素间隔 | 设置箭头键调整的粒度(默认值:20) |
| HorizontalAlignment | HorizontalAlignment | 水平拆分器的对齐方式 | 调整行大小时使用Stretch |
| VerticalAlignment | VerticalAlignment | 垂直拆分器的对齐方式 | 调整列大小时使用Stretch |
| Background | Brush | 拆分器栏的颜色 | 自定义以匹配应用主题 |
| Height | double | 水平拆分器栏的高度 | 为水平拆分器设置明确高度(例如5-10像素) |
| Width | double | 垂直拆分器栏的宽度 | 为垂直拆分器设置明确宽度(例如5-10像素) |