|
@@ -1,4 +1,9 @@
|
|
|
using Avalonia.Controls;
|
|
|
+using Avalonia.Controls.Primitives;
|
|
|
+using Avalonia.Interactivity;
|
|
|
+using Avalonia.VisualTree;
|
|
|
+using Avalonia.Xaml.Interactivity;
|
|
|
+using PixiEditor.Helpers.Behaviours;
|
|
|
|
|
|
namespace PixiEditor.Views.Dock;
|
|
|
|
|
@@ -8,5 +13,28 @@ public partial class ColorPickerDockView : UserControl
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
+ protected override void OnLoaded(RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ base.OnLoaded(e);
|
|
|
+ var textBoxes = this.GetVisualDescendants().OfType<TextBox>().ToArray();
|
|
|
+
|
|
|
+ foreach (var textBox in textBoxes)
|
|
|
+ {
|
|
|
+ var existingBehaviors = Interaction.GetBehaviors(textBox);
|
|
|
+ bool attach = false;
|
|
|
+ if (existingBehaviors == null)
|
|
|
+ {
|
|
|
+ attach = true;
|
|
|
+ existingBehaviors = new BehaviorCollection();
|
|
|
+ }
|
|
|
+
|
|
|
+ existingBehaviors.Add(new GlobalShortcutFocusBehavior());
|
|
|
+
|
|
|
+ if (attach)
|
|
|
+ {
|
|
|
+ Interaction.SetBehaviors(textBox, existingBehaviors);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|