diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.Events.cs b/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.Events.cs
index 0f936ea30ff..e79effd3768 100644
--- a/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.Events.cs
+++ b/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.Events.cs
@@ -13,7 +13,9 @@
using Windows.System;
using Windows.UI.Core;
using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
+using Windows.UI.Xaml.Media;
namespace Microsoft.Toolkit.Uwp.UI.Controls
{
@@ -22,31 +24,23 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
///
public partial class GridSplitter
{
+ // Symbols for GripperBar in Segoe MDL2 Assets
+ private const string GripperBarVertical = "\xE784";
+ private const string GripperBarHorizontal = "\xE76F";
+ private const string GripperDisplayFont = "Segoe MDL2 Assets";
+
private void GridSplitter_Loaded(object sender, RoutedEventArgs e)
{
_resizeDirection = GetResizeDirection();
_resizeBehavior = GetResizeBehavior();
- GridSplitterGripper gripper;
-
// Adding Grip to Grid Splitter
if (Element == default(UIElement))
{
- gripper = new GridSplitterGripper(
- _resizeDirection,
- GripperForeground);
- }
- else
- {
- var content = Element;
- Element = null;
- gripper = new GridSplitterGripper(content, _resizeDirection);
+ CreateGripperDisplay();
+ Element = _gripperDisplay;
}
- Element = gripper;
-
- gripper.KeyDown += Gripper_KeyDown;
-
var hoverWrapper = new GripperHoverWrapper(
CursorBehavior == SplitterCursorBehavior.ChangeOnSplitterHover
? this
@@ -60,15 +54,24 @@ private void GridSplitter_Loaded(object sender, RoutedEventArgs e)
_hoverWrapper = hoverWrapper;
}
- private void Gripper_KeyDown(object sender, KeyRoutedEventArgs e)
+ private void CreateGripperDisplay()
{
- var gripper = sender as GridSplitterGripper;
-
- if (gripper == null)
+ if (_gripperDisplay == null)
{
- return;
+ _gripperDisplay = new TextBlock
+ {
+ FontFamily = new FontFamily(GripperDisplayFont),
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ Foreground = GripperForeground,
+ Text = _resizeDirection == GridResizeDirection.Columns ? GripperBarVertical : GripperBarHorizontal
+ };
}
+ }
+ ///
+ protected override void OnKeyDown(KeyRoutedEventArgs e)
+ {
var step = 1;
var ctrl = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control);
if (ctrl.HasFlag(CoreVirtualKeyStates.Down))
@@ -76,7 +79,7 @@ private void Gripper_KeyDown(object sender, KeyRoutedEventArgs e)
step = 5;
}
- if (gripper.ResizeDirection == GridResizeDirection.Columns)
+ if (_resizeDirection == GridResizeDirection.Columns)
{
if (e.Key == VirtualKey.Left)
{
@@ -95,7 +98,7 @@ private void Gripper_KeyDown(object sender, KeyRoutedEventArgs e)
return;
}
- if (gripper.ResizeDirection == GridResizeDirection.Rows)
+ if (_resizeDirection == GridResizeDirection.Rows)
{
if (e.Key == VirtualKey.Up)
{
@@ -112,6 +115,8 @@ private void Gripper_KeyDown(object sender, KeyRoutedEventArgs e)
e.Handled = true;
}
+
+ base.OnKeyDown(e);
}
///
diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.Options.cs b/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.Options.cs
index de2ccffcfa7..9ba47d4ff62 100644
--- a/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.Options.cs
+++ b/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.Options.cs
@@ -12,6 +12,7 @@
using Windows.UI.Core;
using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
namespace Microsoft.Toolkit.Uwp.UI.Controls
@@ -180,11 +181,13 @@ public SplitterCursorBehavior CursorBehavior
private static void OnGripperForegroundPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var gridSplitter = (GridSplitter)d;
- var grip = gridSplitter.Element as GridSplitterGripper;
- if (grip != null)
+
+ if (gridSplitter._gripperDisplay == null)
{
- grip.GripperForeground = gridSplitter.GripperForeground;
+ return;
}
+
+ gridSplitter._gripperDisplay.Foreground = gridSplitter.GripperForeground;
}
private static void OnGripperCursorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.cs b/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.cs
index 93c8553ab6a..bd847824b14 100644
--- a/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.cs
+++ b/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.cs
@@ -31,6 +31,7 @@ public partial class GridSplitter : Control
private GridResizeDirection _resizeDirection;
private GridResizeBehavior _resizeBehavior;
private GripperHoverWrapper _hoverWrapper;
+ private TextBlock _gripperDisplay;
///
/// Gets the target parent grid from level
diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.xaml b/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.xaml
index 83941258f32..009a8cbb193 100644
--- a/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.xaml
+++ b/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.xaml
@@ -3,12 +3,14 @@
xmlns:local="using:Microsoft.Toolkit.Uwp.UI.Controls">