Make sure to do the same for History tab
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabView.xaml
</Grid>
<controls:ExtendedListBox Items="{Binding Transactions}" SelectedItem="{Binding SelectedTransaction, Mode=TwoWay}">
<controls:ExtendedListBox.ContextMenu>
- <ContextMenu>
+ <ContextMenu IsVisible="{Binding IsItemSelected}">
<MenuItem Header="Copy transaction ID" Command="{Binding CopyTransactionId}">
<MenuItem.Icon>
<DrawingPresenter HorizontalAlignment="Left" Height="16" Width="16" Stretch="Fill" Drawing="{StaticResource ReceiveTabView_CopyIcon}" />

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
@@ -20,6 +20,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private CompositeDisposable Disposables { get; set; }
private ObservableCollection<TransactionViewModel> _transactions;
+ private ObservableAsPropertyHelper<bool> _isItemSelected;
private TransactionViewModel _selectedTransaction;
private SortOrder _dateSortDirection;
private SortOrder _amountSortDirection;
@@ -35,18 +36,22 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
SortCommand = ReactiveCommand.Create(RefreshOrdering);
DateSortDirection = SortOrder.Decreasing;
- var isCoinListItemSelected = this.WhenAnyValue(x => x.SelectedTransaction).Select(tx => tx is { });
+ _isItemSelected = this
+ .WhenAnyValue(x => x.SelectedTransaction)
+ .Select(x => x is { })
+ .ToProperty(this, x => x.IsItemSelected, scheduler: RxApp.MainThreadScheduler);
+ IObservable<bool> canExecuteContextMenuItem = this.WhenAnyValue(x => x.IsItemSelected);
CopyTransactionId = ReactiveCommand.CreateFromTask(async () =>
{
- if (SelectedTransaction is null)
+ var selectedTransaction = SelectedTransaction;
+ if (selectedTransaction is null)
{
return;
}
- await SelectedTransaction.TryCopyTxIdToClipboardAsync();
- },
- isCoinListItemSelected);
+ await selectedTransaction.TryCopyTxIdToClipboardAsync();
+ }, canExecuteContextMenuItem);
Observable
.Merge(SortCommand.ThrownExceptions)
@@ -135,6 +140,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
set => this.RaiseAndSetIfChanged(ref _transactions, value);
}
+ public bool IsItemSelected => _isItemSelected?.Value ?? default;
+
public TransactionViewModel SelectedTransaction
{
get => _selectedTransaction;

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
@@ -92,12 +92,13 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
CopyAddress = ReactiveCommand.CreateFromTask(async () =>
{
- if (SelectedAddress is null)
+ var selectedAddress = SelectedAddress;
+ if (selectedAddress is null)
{
return;
}
- await SelectedAddress.TryCopyToClipboardAsync();
+ await selectedAddress.TryCopyToClipboardAsync();
}, canExecuteContextMenuItem);
CopyLabel = ReactiveCommand.CreateFromTask(async () => await Application.Current.Clipboard.SetTextAsync(SelectedAddress?.Label ?? string.Empty), canExecuteContextMenuItem);

Make sure to do the same for History tab