collapse on click when on compact mode
MODIFY
WalletWasabi.Fluent/Behaviors/SplitViewAutoBehavior.cs
WalletWasabi.Fluent/Behaviors/SplitViewAutoBehavior.cs
@@ -21,6 +21,9 @@ namespace WalletWasabi.Fluent.Behaviors
public static readonly StyledProperty<Action> ToggleActionProperty =
AvaloniaProperty.Register<SplitViewAutoBehavior, Action>(nameof(ToggleAction));
+ public static readonly StyledProperty<Action> CollapseOnClickActionProperty =
+ AvaloniaProperty.Register<SplitViewAutoBehavior, Action>(nameof(CollapseOnClickAction));
+
public double CollapseThreshold
{
get => GetValue(CollapseThresholdProperty);
@@ -33,6 +36,12 @@ namespace WalletWasabi.Fluent.Behaviors
set => SetValue(ToggleActionProperty, value);
}
+ public Action CollapseOnClickAction
+ {
+ get => GetValue(CollapseOnClickActionProperty);
+ set => SetValue(CollapseOnClickActionProperty, value);
+ }
+
protected override void OnAttached()
{
Disposables = new CompositeDisposable();
@@ -42,10 +51,19 @@ namespace WalletWasabi.Fluent.Behaviors
.Subscribe(SplitViewBoundsChanged));
ToggleAction = OnToggleAction;
+ CollapseOnClickAction = OnCollapseOnClickAction;
base.OnAttached();
}
+ private void OnCollapseOnClickAction()
+ {
+ if (AssociatedObject.Bounds.Width <= CollapseThreshold & AssociatedObject.IsPaneOpen)
+ {
+ AssociatedObject.IsPaneOpen = false;
+ }
+ }
+
private void OnToggleAction()
{
if (AssociatedObject.IsPaneOpen)

MODIFY
WalletWasabi.Fluent/ViewModels/NavBarViewModel.cs
WalletWasabi.Fluent/ViewModels/NavBarViewModel.cs
@@ -20,10 +20,12 @@ namespace WalletWasabi.Fluent.ViewModels
private Dictionary<Wallet, WalletViewModelBase> _walletDictionary;
private bool _anyWalletStarted;
private bool _isBackButtonVisible;
- private Action _toggleAction;
private IScreen _screen;
private bool _isNavigating;
+ private Action _toggleAction;
+ private Action _collapseOnClickAction;
+
public NavBarViewModel(IScreen screen, RoutingState router, WalletManager walletManager, UiConfig uiConfig)
{
_screen = screen;
@@ -58,6 +60,7 @@ namespace WalletWasabi.Fluent.ViewModels
if (!_isNavigating)
{
Router.NavigateAndReset.Execute(x);
+ CollapseOnClickAction?.Invoke();
}
});
@@ -174,6 +177,13 @@ namespace WalletWasabi.Fluent.ViewModels
set { this.RaiseAndSetIfChanged(ref _toggleAction, value); }
}
+
+ public Action CollapseOnClickAction
+ {
+ get { return _collapseOnClickAction; }
+ set { this.RaiseAndSetIfChanged(ref _collapseOnClickAction, value); }
+ }
+
public bool IsBackButtonVisible
{
get => _isBackButtonVisible;

MODIFY
WalletWasabi.Fluent/Views/MainView.axaml
WalletWasabi.Fluent/Views/MainView.axaml
x:Class="WalletWasabi.Fluent.Views.MainView" TextBlock.Foreground="#A3A3A3">
<SplitView>
<i:Interaction.Behaviors>
- <behaviors:SplitViewAutoBehavior ToggleAction="{Binding NavBar.ToggleAction, Mode=OneWayToSource}" CollapseThreshold="{StaticResource SplitViewCollapseThreshold}"/>
+ <behaviors:SplitViewAutoBehavior ToggleAction="{Binding NavBar.ToggleAction, Mode=OneWayToSource}"
+ CollapseOnClickAction="{Binding NavBar.CollapseOnClickAction, Mode=OneWayToSource}"
+ CollapseThreshold="{StaticResource SplitViewCollapseThreshold}"/>
</i:Interaction.Behaviors>
<SplitView.Pane>
<Panel>

collapse on click when on compact mode