use tagsbox control on labels.
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Receive/ReceiveViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Receive/ReceiveViewModel.cs
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Windows.Input;
+using DynamicData.Binding;
using ReactiveUI;
using WalletWasabi.Blockchain.Analysis.Clustering;
using WalletWasabi.Blockchain.Keys;
@@ -22,35 +24,31 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Receive
NavigationTarget = NavigationTarget.DialogScreen)]
public partial class ReceiveViewModel : NavBarItemViewModel
{
- [AutoNotify] private string _reference;
+ [AutoNotify] private ObservableCollection<string> _labels;
[AutoNotify] private HashSet<string> _suggestions;
[AutoNotify] private bool _isExistingAddressesButtonVisible;
public ReceiveViewModel(WalletViewModelBase wallet, WalletManager walletManager, BitcoinStore bitcoinStore) : base(NavigationMode.Normal)
{
WasabiWallet = wallet.Wallet;
- _reference = "";
+ _labels = new ObservableCollection<string>();
_suggestions = GetLabels(walletManager, bitcoinStore);
SelectionMode = NavBarItemSelectionMode.Button;
- var nextCommandCanExecute =
- this.WhenAnyValue(x => x.Reference)
- .ObserveOn(RxApp.MainThreadScheduler)
- .Select(reference => !string.IsNullOrEmpty(reference));
-
SetupCancel(enableCancel: true, enableCancelOnEscape: true, enableCancelOnPressed: true);
EnableBack = false;
- NextCommand = ReactiveCommand.Create(OnNext, nextCommandCanExecute);
+ NextCommand = ReactiveCommand.Create(OnNext, _labels.ToObservableChangeSet()
+ .Select(_ => _labels.Count > 0));
ShowExistingAddressesCommand = ReactiveCommand.Create(OnShowExistingAddresses);
}
private void OnNext()
{
- var newKey = WasabiWallet.KeyManager.GetNextReceiveKey(Reference, out bool minGapLimitIncreased);
+ var newKey = WasabiWallet.KeyManager.GetNextReceiveKey(new SmartLabel(Labels), out bool minGapLimitIncreased);
if (minGapLimitIncreased)
{
@@ -78,7 +76,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Receive
base.OnNavigatedTo(isInHistory, disposable);
IsExistingAddressesButtonVisible = WasabiWallet.KeyManager.GetKeys(x => !x.Label.IsEmpty && !x.IsInternal && x.KeyState == KeyState.Clean).Any();
- Reference = "";
+ Labels.Clear();
}
private HashSet<string> GetLabels(WalletManager walletManager, BitcoinStore store)

MODIFY
WalletWasabi.Fluent/Views/Wallets/Receive/ReceiveView.axaml
WalletWasabi.Fluent/Views/Wallets/Receive/ReceiveView.axaml
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:c="using:WalletWasabi.Fluent.Controls"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
- xmlns:behaviors="using:WalletWasabi.Fluent.Behaviors"
- xmlns:i="using:Avalonia.Xaml.Interactivity"
+ xmlns:behaviors="clr-namespace:WalletWasabi.Fluent.Behaviors"
+ xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity"
xmlns:receive="clr-namespace:WalletWasabi.Fluent.ViewModels.Wallets.Receive"
x:DataType="receive:ReceiveViewModel"
x:CompileBindings="True"
EnableBack="{Binding EnableBack}">
<DockPanel>
<StackPanel DockPanel.Dock="Top" HorizontalAlignment="Stretch">
- <Label Content="_Reference" Target="ReferenceTbx" HorizontalAlignment="Left" FontWeight="Normal" />
- <AutoCompleteBox Text="{Binding Reference}"
- x:Name="ReferenceTbx"
- Watermark='Who knows this address is yours? E.g.: "Max, BitPay"'
- HorizontalAlignment="Stretch"
- MinimumPrefixLength="1"
- IsTextCompletionEnabled="True"
- Items="{Binding Suggestions}">
- <AutoCompleteBox.Styles>
- <Style Selector="AutoCompleteBox /template/ Popup#PART_Popup">
- <Setter Property="MaxWidth" Value="{Binding #ReferenceTbx.Bounds.Width}"/>
- </Style>
- </AutoCompleteBox.Styles>
+ <Label Content="_Labels" Target="LabelsTbx" HorizontalAlignment="Left" FontWeight="Normal" />
+ <c:TagsBox x:Name="LabelsTbx" Items="{Binding Labels}"
+ Watermark="Who will know this address? Alice, Bob, Coinbase, Binance"
+ Suggestions="{Binding Suggestions}">
<i:Interaction.Behaviors>
<behaviors:FocusOnAttachedBehavior />
</i:Interaction.Behaviors>
- </AutoCompleteBox>
+ </c:TagsBox>
</StackPanel>
<Button Content="Previous unused addresses" IsVisible="{Binding IsExistingAddressesButtonVisible}" Classes="h8 plain activeHyperLink" Command="{Binding ShowExistingAddressesCommand}" HorizontalAlignment="Center" VerticalAlignment="Bottom" DockPanel.Dock="Bottom"/>

use tagsbox control on labels.