Paste bitcoin address automatically
ADD
WalletWasabi.Gui/Behaviors/PasteAddressOnClickBehavior.cs
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Input;
+using Avalonia.Input.Platform;
+using Avalonia.Interactivity;
+using Avalonia.Xaml.Interactivity;
+using NBitcoin;
+using System;
+using System.Reactive.Disposables;
+using System.Reactive.Linq;
+
+namespace WalletWasabi.Gui.Behaviors
+{
+ internal class PasteAddressOnClickBehavior : Behavior<TextBox>
+ {
+ private CompositeDisposable _disposables = new CompositeDisposable();
+
+ public void PasteClipboardContentIfBitcoinAddress()
+ {
+ var clipboard = (IClipboard)AvaloniaLocator.Current.GetService(typeof(IClipboard));
+ var text = clipboard.GetTextAsync().GetAwaiter().GetResult();
+
+ try
+ {
+ var address = BitcoinAddress.Create(text, Global.Network);
+ if(address is BitcoinWitPubKeyAddress)
+ {
+ if(string.IsNullOrWhiteSpace(AssociatedObject.Text) )
+ AssociatedObject.Text = text;
+ }
+ }
+ catch(FormatException)
+ {
+ }
+ }
+
+ protected override void OnAttached()
+ {
+ _disposables = new CompositeDisposable
+ {
+ Observable.FromEventPattern<RoutedEventArgs>(AssociatedObject, nameof(AssociatedObject.LostFocus)).Subscribe(args=>
+ {
+ PasteClipboardContentIfBitcoinAddress();
+ })
+ };
+
+ base.OnAttached();
+ }
+
+ protected override void OnDetaching()
+ {
+ base.OnDetaching();
+
+ _disposables.Dispose();
+ }
+ }
+}

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/SendTabView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/SendTabView.xaml
<DockPanel LastChildFill="True" Margin="20">
<StackPanel DockPanel.Dock="Bottom" Margin="0 10" Spacing="10" HorizontalAlignment="Left">
<TextBlock>Note that, you must select coins you want to spend from.</TextBlock>
- <controls:ExtendedTextBox Text="{Binding Address}" Watermark="Address" UseFloatingWatermark="True" />
+ <controls:ExtendedTextBox Text="{Binding Address}" Watermark="Address" UseFloatingWatermark="True" >
+ <i:Interaction.Behaviors>
+ <behaviors:PasteAddressOnClickBehavior />
+ </i:Interaction.Behaviors>
+ </controls:ExtendedTextBox>
<controls:ExtendedTextBox Text="{Binding Label}" Watermark="Label" UseFloatingWatermark="True">
<ToolTip.Tip>
Start labelling today and your privacy will thank you tomorrow!

Paste bitcoin address automatically