Add an extension to automatically bring the focused element into view.
MODIFY
WalletWasabi.Fluent/App.xaml.cs
WalletWasabi.Fluent/App.xaml.cs
@@ -2,6 +2,7 @@ using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
+using WalletWasabi.Fluent.Behaviors;
using WalletWasabi.Fluent.ViewModels;
using WalletWasabi.Fluent.Views;
using Global = WalletWasabi.Gui.Global;
@@ -29,6 +30,8 @@ namespace WalletWasabi.Fluent
public override void OnFrameworkInitializationCompleted()
{
+ AutoBringIntoViewExtension.Initialise();
+
if (!Design.IsDesignMode)
{
MainViewModel.Instance = new MainViewModel(_global);

ADD
WalletWasabi.Fluent/Behaviors/AutoBringIntoViewExtension.cs
+using Avalonia.Controls;
+using Avalonia.Input;
+using ReactiveUI;
+using System;
+using System.Reactive.Linq;
+
+namespace WalletWasabi.Fluent.Behaviors
+{
+ public static class AutoBringIntoViewExtension
+ {
+ private static bool Initialised { get; set; }
+
+ public static void Initialise()
+ {
+ if (!Initialised)
+ {
+ Initialised = true;
+
+ KeyboardDevice.Instance.WhenAnyValue(x => x.FocusedElement)
+ .OfType<IControl>()
+ .Subscribe(x =>
+ {
+ static void BringParentToView(IInputElement ie)
+ {
+ if (ie.VisualParent is IInputElement parent && parent.IsKeyboardFocusWithin)
+ {
+ BringParentToView(parent);
+ }
+
+ if (ie is IControl ic)
+ {
+ ic.BringIntoView();
+ }
+ }
+
+ if (x is IInputElement ie)
+ {
+ BringParentToView(ie);
+ }
+ });
+ }
+ }
+ }
+}

Add an extension to automatically bring the focused element into view.