[Fluent] Collapse navbar view when there are no wallets available.
MODIFY
WalletWasabi.Fluent/ViewModels/NavBar/NavBarViewModel.cs
WalletWasabi.Fluent/ViewModels/NavBar/NavBarViewModel.cs
@@ -3,6 +3,8 @@ using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive.Linq;
+using DynamicData;
+using DynamicData.Binding;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Fluent.ViewModels.Wallets;
@@ -23,6 +25,7 @@ namespace WalletWasabi.Fluent.ViewModels.NavBar
private bool _isOpen;
private Action? _toggleAction;
private Action? _collapseOnClickAction;
+ private double _currentOpenPaneLength;
public NavBarViewModel(TargettedNavigationStack mainScreen, WalletManagerViewModel walletManager)
{
@@ -46,6 +49,14 @@ namespace WalletWasabi.Fluent.ViewModels.NavBar
SelectedItem.IsExpanded = x;
}
});
+
+ walletManager.WhenAnyValue(x => x.Items)
+ .Subscribe(x =>
+ {
+ x.ObserveCollectionChanges()
+ .ToObservableChangeSet()
+ .Subscribe(y => CurrentOpenPaneLength = y.Count > 0 ? 280 : 0);
+ });
}
public ObservableCollection<NavBarItemViewModel> TopItems
@@ -80,6 +91,12 @@ namespace WalletWasabi.Fluent.ViewModels.NavBar
set => this.RaiseAndSetIfChanged(ref _collapseOnClickAction, value);
}
+ public double CurrentOpenPaneLength
+ {
+ get => _currentOpenPaneLength;
+ set => this.RaiseAndSetIfChanged(ref _currentOpenPaneLength, value);
+ }
+
public bool IsBackButtonVisible
{
get => _isBackButtonVisible;

MODIFY
WalletWasabi.Fluent/Views/MainView.axaml
WalletWasabi.Fluent/Views/MainView.axaml
x:Class="WalletWasabi.Fluent.Views.MainView">
<Panel>
<SplitView
- IsEnabled="{Binding IsMainContentEnabled}" CompactPaneLength="68" OpenPaneLength="280"
+ IsEnabled="{Binding IsMainContentEnabled}" CompactPaneLength="68" OpenPaneLength="{Binding NavBar.CurrentOpenPaneLength}"
IsPaneOpen="{Binding NavBar.IsOpen, Mode=TwoWay}">
<i:Interaction.Behaviors>
<behaviors:SplitViewAutoBehavior ToggleAction="{Binding NavBar.ToggleAction, Mode=OneWayToSource}"

[Fluent] Collapse navbar view when there are no wallets available.