Save on lost textbox focus instead on character change.
ADD
WalletWasabi.Gui/Behaviors/CommandOnLostFocusBehavior.cs
+using Avalonia.Controls;
+using Avalonia.Input;
+using Avalonia.Interactivity;
+using System;
+using System.Collections.Generic;
+using System.Reactive.Disposables;
+using System.Text;
+
+namespace WalletWasabi.Gui.Behaviors
+{
+ internal class CommandOnLostFocusBehavior : CommandBasedBehavior<Control>
+ {
+ private CompositeDisposable Disposables { get; set; }
+
+ protected override void OnAttached()
+ {
+ Disposables = new CompositeDisposable();
+
+ base.OnAttached();
+
+ Disposables.Add(AssociatedObject.AddHandler(InputElement.LostFocusEvent, (sender, e) =>
+ {
+ e.Handled = ExecuteCommand();
+ }));
+ }
+
+ protected override void OnDetaching()
+ {
+ base.OnDetaching();
+
+ Disposables?.Dispose();
+ }
+ }
+}

MODIFY
WalletWasabi.Gui/Tabs/SettingsViewModel.cs
WalletWasabi.Gui/Tabs/SettingsViewModel.cs
@@ -34,6 +34,7 @@ namespace WalletWasabi.Gui.Tabs
public ReactiveCommand<Unit, Unit> OpenConfigFileCommand { get; }
public ReactiveCommand<Unit, Unit> LurkingWifeModeCommand { get; }
+ public ReactiveCommand<Unit, Unit> TextBoxLostFocusCommand { get; }
public SettingsViewModel(Global global) : base(global, "Settings")
{
@@ -57,22 +58,7 @@ namespace WalletWasabi.Gui.Tabs
this.WhenAnyValue(
x => x.Network,
- x => x.BitcoinP2pEndPoint,
- x => x.DustThreshold)
- .ObserveOn(RxApp.TaskpoolScheduler)
- .Subscribe(x => Save());
-
- this.WhenAnyValue(
- x => x.UseTor,
- x => x.TorSocks5EndPoint)
- .ObserveOn(RxApp.TaskpoolScheduler)
- .Subscribe(x => Save());
-
- this.WhenAnyValue(
- x => x.SomePrivacyLevel,
- x => x.FinePrivacyLevel,
- x => x.StrongPrivacyLevel,
- x => x.DustThreshold)
+ x => x.UseTor)
.ObserveOn(RxApp.TaskpoolScheduler)
.Subscribe(x => Save());
@@ -107,6 +93,8 @@ namespace WalletWasabi.Gui.Tabs
Global.UiConfig.LurkingWifeMode = !LurkingWifeMode;
await Global.UiConfig.ToFileAsync();
});
+
+ TextBoxLostFocusCommand = ReactiveCommand.Create(Save);
}
public override void OnOpen()

Save on lost textbox focus instead on character change.