|
|
|
@ -84,7 +84,7 @@ namespace Avalonia.Controls |
|
|
|
{ |
|
|
|
if (_root != null && _hotkey != null) |
|
|
|
{ |
|
|
|
_binding = new KeyBinding() { Gesture = _hotkey, Command = _wrapper }; |
|
|
|
_binding = new KeyBinding() {Gesture = _hotkey, Command = _wrapper}; |
|
|
|
_root.KeyBindings.Add(_binding); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -102,12 +102,11 @@ namespace Avalonia.Controls |
|
|
|
HotKeyProperty.Changed.Subscribe(args => |
|
|
|
{ |
|
|
|
var control = args.Sender as IControl; |
|
|
|
if (args.OldValue != null || control == null) |
|
|
|
if (args.OldValue != null|| control == null) |
|
|
|
return; |
|
|
|
new Manager(control).Init(); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public static void SetHotKey(AvaloniaObject target, KeyGesture value) => target.SetValue(HotKeyProperty, value); |
|
|
|
public static KeyGesture GetHotKey(AvaloniaObject target) => target.GetValue(HotKeyProperty); |
|
|
|
} |
|
|
|
|