Simplify AnySelected
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Advanced/WalletCoins/WalletCoinsViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Advanced/WalletCoins/WalletCoinsViewModel.cs
@@ -28,7 +28,7 @@ public partial class WalletCoinsViewModel : RoutableViewModel
private readonly ObservableCollectionExtended<WalletCoinViewModel> _coins;
private readonly SourceList<WalletCoinViewModel> _coinsSourceList = new();
[AutoNotify] private FlatTreeDataGridSource<WalletCoinViewModel>? _source;
- [AutoNotify] private bool _anySelected;
+ [AutoNotify] private IObservable<bool> _anySelected;
public WalletCoinsViewModel(WalletViewModel walletViewModel, IObservable<Unit> balanceChanged)
{
@@ -89,13 +89,10 @@ public partial class WalletCoinsViewModel : RoutableViewModel
.Subscribe()
.DisposeWith(disposables);
- _coinsSourceList
- .Connect()
- .ObserveOn(RxApp.MainThreadScheduler)
- .WhenValueChanged(x => x.IsSelected)
- .Select(_ => _coinsSourceList.Items.Any(x => x.IsSelected))
- .Subscribe(anySelected => AnySelected = anySelected)
- .DisposeWith(disposables);
+ AnySelected = _coinsSourceList.Connect()
+ .AutoRefresh(x => x.IsSelected)
+ .ToCollection()
+ .Select(items => items.Any(t => t.IsSelected));
Observable.Timer(TimeSpan.FromSeconds(30))
.Subscribe(_ =>

MODIFY
WalletWasabi.Fluent/Views/Wallets/Advanced/WalletCoins/WalletCoinsView.axaml
WalletWasabi.Fluent/Views/Wallets/Advanced/WalletCoins/WalletCoinsView.axaml
ScrollViewer.VerticalScrollBarVisibility="Disabled"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
SkipContent="Send selected coins"
- EnableSkip="{Binding AnySelected}">
+ EnableSkip="{Binding AnySelected^}">
<TreeDataGrid Source="{Binding Source}"
CanUserSortColumns="True">
<TreeDataGrid.Styles>

Simplify AnySelected