Remove IsVisible and related code.
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 IsVisible="{Binding IsItemSelected}">
+ <ContextMenu>
<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,7 +20,6 @@ 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;
@@ -36,12 +35,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
SortCommand = ReactiveCommand.Create(RefreshOrdering);
DateSortDirection = SortOrder.Decreasing;
- _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 () =>
{
var selectedTransaction = SelectedTransaction;
@@ -51,7 +44,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
await selectedTransaction.TryCopyTxIdToClipboardAsync();
- }, canExecuteContextMenuItem);
+ });
Observable
.Merge(SortCommand.ThrownExceptions)
@@ -140,8 +133,6 @@ 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/ReceiveTabView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabView.xaml
</Style>
</controls:ExtendedListBox.Styles>
<controls:ExtendedListBox.ContextMenu>
- <ContextMenu IsVisible="{Binding IsItemSelected}">
+ <ContextMenu>
<MenuItem Header="{Binding SelectedAddress.ExpandMenuCaption}" Command="{Binding ToggleQrCode}">
<MenuItem.Icon>
<DrawingPresenter HorizontalAlignment="Left" Height="16" Width="16" Stretch="Fill" Drawing="{StaticResource ReceiveTabView_ToggleQrCode}" />

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
@@ -28,7 +28,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private ObservableCollection<AddressViewModel> _addresses;
private AddressViewModel _selectedAddress;
private SuggestLabelViewModel _labelSuggestion;
- private ObservableAsPropertyHelper<bool> _isItemSelected;
public ReactiveCommand<Unit, Unit> CopyAddress { get; }
public ReactiveCommand<Unit, Unit> CopyLabel { get; }
@@ -74,13 +73,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
});
});
- _isItemSelected = this
- .WhenAnyValue(x => x.SelectedAddress)
- .Select(x => x is { })
- .ToProperty(this, x => x.IsItemSelected, scheduler: RxApp.MainThreadScheduler);
- IObservable<bool> canExecuteContextMenuItem = this.WhenAnyValue(x => x.IsItemSelected);
-
- this.WhenAnyValue(x => x.SelectedAddress).Subscribe(async address =>
+ this.WhenAnyValue(x => x.SelectedAddress)
+ .Subscribe(async address =>
{
if (Global.UiConfig?.Autocopy is false || address is null)
{
@@ -99,9 +93,9 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
await selectedAddress.TryCopyToClipboardAsync();
- }, canExecuteContextMenuItem);
+ });
- CopyLabel = ReactiveCommand.CreateFromTask(async () => await Application.Current.Clipboard.SetTextAsync(SelectedAddress?.Label ?? string.Empty), canExecuteContextMenuItem);
+ CopyLabel = ReactiveCommand.CreateFromTask(async () => await Application.Current.Clipboard.SetTextAsync(SelectedAddress?.Label ?? string.Empty));
ToggleQrCode = ReactiveCommand.Create(() =>
{
@@ -112,7 +106,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
selectedAddress.IsExpanded = !selectedAddress.IsExpanded;
- }, canExecuteContextMenuItem);
+ });
ChangeLabelCommand = ReactiveCommand.Create(() =>
{
@@ -123,7 +117,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
SelectedAddress.InEditMode = true;
- }, canExecuteContextMenuItem);
+ });
DisplayAddressOnHwCommand = ReactiveCommand.CreateFromTask(async () =>
{
@@ -144,7 +138,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
await PinPadViewModel.UnlockAsync(Global);
await client.DisplayAddressAsync(KeyManager.MasterFingerprint.Value, selectedAddress.Model.FullKeyPath, cts.Token);
}
- }, canExecuteContextMenuItem);
+ });
SaveQRCodeCommand = ReactiveCommand.CreateFromTask(async () =>
{
@@ -155,7 +149,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
await selectedAddress.SaveQRCodeAsync();
- }, canExecuteContextMenuItem);
+ });
Observable
.Merge(DisplayAddressOnHwCommand.ThrownExceptions)
@@ -232,7 +226,5 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
get => _selectedAddress;
set => this.RaiseAndSetIfChanged(ref _selectedAddress, value);
}
-
- public bool IsItemSelected => _isItemSelected?.Value ?? default;
}
}

Remove IsVisible and related code.