Skip to content

Commit 3656dfb

Browse files
committed
Adjust GridSplitter styles and add hidden variant
1 parent a943aa3 commit 3656dfb

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

src/Wpf.Ui.Violeta/Controls/GridSplitter/GridSplitter.xaml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
22

3-
<!--
4-
Preview adorner style – shown while dragging when ShowsPreview=True.
5-
Resize only takes effect on mouse release.
6-
-->
73
<Style x:Key="GridSplitterPreviewStyle">
84
<Setter Property="Control.Template">
95
<Setter.Value>
@@ -17,14 +13,9 @@
1713
</Setter>
1814
</Style>
1915

20-
<!--
21-
• ShowsPreview = True → resize commits only on mouse release
22-
• MinWidth / MinHeight ensure the Auto-sized row/column is never 0-px
23-
• Outer border is transparent with Padding=2 for a wider hit-test area
24-
• Inner visual bar has no content children — avoids any layout-jump on hover
25-
• Hover / Focus → bar turns accent colour
26-
-->
2716
<Style x:Key="DefaultGridSplitterStyle" TargetType="{x:Type GridSplitter}">
17+
<Setter Property="OverridesDefaultStyle" Value="True" />
18+
<Setter Property="IsTabStop" Value="True" />
2819
<Setter Property="ShowsPreview" Value="True" />
2920
<Setter Property="MinWidth" Value="6" />
3021
<Setter Property="MinHeight" Value="6" />
@@ -41,10 +32,10 @@
4132
<!-- Transparent outer region — widens the grab area beyond the visual bar -->
4233
<Border
4334
x:Name="Root"
44-
Padding="2"
35+
Margin="1"
36+
Padding="1"
4537
Background="Transparent"
4638
SnapsToDevicePixels="True">
47-
<!-- Visual bar — no children so its size never jumps -->
4839
<Border
4940
x:Name="Bar"
5041
Background="{DynamicResource ControlStrokeColorDefaultBrush}"
@@ -68,4 +59,12 @@
6859

6960
<Style BasedOn="{StaticResource DefaultGridSplitterStyle}" TargetType="GridSplitter" />
7061

62+
<Style
63+
x:Key="HiddenGridSplitterStyle"
64+
BasedOn="{StaticResource DefaultGridSplitterStyle}"
65+
TargetType="{x:Type GridSplitter}">
66+
<Setter Property="MinWidth" Value="0" />
67+
<Setter Property="MinHeight" Value="0" />
68+
</Style>
69+
7170
</ResourceDictionary>

0 commit comments

Comments
 (0)