diff --git a/demo/Ursa.Demo/Pages/KeyGestureInputDemo.axaml b/demo/Ursa.Demo/Pages/KeyGestureInputDemo.axaml
index 406c353..71f3e00 100644
--- a/demo/Ursa.Demo/Pages/KeyGestureInputDemo.axaml
+++ b/demo/Ursa.Demo/Pages/KeyGestureInputDemo.axaml
@@ -13,8 +13,14 @@
mc:Ignorable="d">
-
+
-
+
\ No newline at end of file
diff --git a/src/Ursa.Themes.Semi/Controls/KeyGestureInput.axaml b/src/Ursa.Themes.Semi/Controls/KeyGestureInput.axaml
index 2bbbd31..0892fd1 100644
--- a/src/Ursa.Themes.Semi/Controls/KeyGestureInput.axaml
+++ b/src/Ursa.Themes.Semi/Controls/KeyGestureInput.axaml
@@ -2,6 +2,7 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="using:Avalonia.Controls.Converters"
+ xmlns:ursaConverters="using:Ursa.Converters"
xmlns:u="https://irihi.tech/ursa">
@@ -12,7 +13,7 @@
-
+
-
+
+
+
+
+
+
+
+
@@ -45,5 +76,13 @@
+
+
+
diff --git a/src/Ursa/Controls/KeyGestureInput.cs b/src/Ursa/Controls/KeyGestureInput.cs
index 5c4e535..042075b 100644
--- a/src/Ursa/Controls/KeyGestureInput.cs
+++ b/src/Ursa/Controls/KeyGestureInput.cs
@@ -1,23 +1,29 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Converters;
+using Avalonia.Controls.Metadata;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Layout;
+using Irihi.Avalonia.Shared.Contracts;
namespace Ursa.Controls;
-public class KeyGestureInput: TemplatedControl
+[PseudoClasses(PC_Empty)]
+public class KeyGestureInput: TemplatedControl, IClearControl, IInnerContentControl
{
+ public const string PC_Empty = ":empty";
static KeyGestureInput()
{
- InputElement.FocusableProperty.OverrideDefaultValue(true);
+ FocusableProperty.OverrideDefaultValue(true);
+ GestureProperty.Changed.AddClassHandler((x, e) =>
+ x.PseudoClasses.Set(PC_Empty, e.NewValue.Value is null));
}
- public static readonly StyledProperty GestureProperty = AvaloniaProperty.Register(
+ public static readonly StyledProperty GestureProperty = AvaloniaProperty.Register(
nameof(Gesture));
- public KeyGesture Gesture
+ public KeyGesture? Gesture
{
get => GetValue(GestureProperty);
set => SetValue(GestureProperty, value);
@@ -60,7 +66,30 @@ public class KeyGestureInput: TemplatedControl
get => GetValue(VerticalContentAlignmentProperty);
set => SetValue(VerticalContentAlignmentProperty, value);
}
-
+
+ public static readonly StyledProperty