attempt 1 for binding toggle to behavior
MODIFY
WalletWasabi.Fluent/Behaviors/SplitViewAutoBehavior.cs
WalletWasabi.Fluent/Behaviors/SplitViewAutoBehavior.cs
@@ -16,12 +16,24 @@ namespace WalletWasabi.Fluent.Behaviors
public static readonly StyledProperty<double> CollapseThresholdProperty =
AvaloniaProperty.Register<SplitViewAutoBehavior, double>(nameof(CollapseThreshold));
+ public static readonly StyledProperty<bool> IsExpandedProperty =
+ AvaloniaProperty.Register<SplitViewAutoBehavior, bool>(nameof(IsExpanded));
+
public double CollapseThreshold
{
get => GetValue(CollapseThresholdProperty);
set => SetValue(CollapseThresholdProperty, value);
}
+ public bool IsExpanded
+ {
+ get => GetValue(IsExpandedProperty);
+ set
+ {
+ SetValue(IsExpandedProperty, value);
+ }
+ }
+
protected override void OnAttached()
{
Disposables = new CompositeDisposable();

MODIFY
WalletWasabi.Fluent/ViewModels/NavBarViewModel.cs
WalletWasabi.Fluent/ViewModels/NavBarViewModel.cs
@@ -18,6 +18,8 @@ namespace WalletWasabi.Fluent.ViewModels
private NavBarItemViewModel _selectedItem;
private Dictionary<Wallet, WalletViewModelBase> _walletDictionary;
private bool _anyWalletStarted;
+ private bool _isExpanded;
+
public NavBarViewModel(WalletManager walletManager, UiConfig uiConfig)
{
@@ -110,6 +112,12 @@ namespace WalletWasabi.Fluent.ViewModels
}
}
+ public bool IsExpanded
+ {
+ get { return _isExpanded; }
+ set { this.RaiseAndSetIfChanged(ref _isExpanded, value); }
+ }
+
private void LoadWallets(WalletManager walletManager)
{
foreach (var wallet in walletManager.GetWallets())

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 CollapseThreshold="{StaticResource SplitViewCollapseThreshold}"/>
+ <behaviors:SplitViewAutoBehavior IsExpanded="{Binding $parent[SplitView].DataContext.NavBar.IsExpanded}" CollapseThreshold="{StaticResource SplitViewCollapseThreshold}"/>
</i:Interaction.Behaviors>
<SplitView.Pane>
<Panel>

MODIFY
WalletWasabi.Fluent/Views/NavBar.axaml
WalletWasabi.Fluent/Views/NavBar.axaml
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:WalletWasabi.Fluent.ViewModels"
xmlns:c="clr-namespace:WalletWasabi.Fluent.Controls"
+ xmlns:behaviors="clr-namespace:WalletWasabi.Fluent.Behaviors;assembly=WalletWasabi.Fluent"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="WalletWasabi.Fluent.Views.NavBar">
<UserControl.Styles>
<DockPanel Margin="1">
<StackPanel DockPanel.Dock="Top" Margin="0 0 0 0">
<StackPanel Orientation="Horizontal" Spacing="5">
- <ToggleButton Classes="NavButton" IsChecked="{Binding $parent[SplitView].IsPaneOpen}">
+ <ToggleButton Classes="NavButton" IsChecked="{Binding $parent[behaviors:SplitViewAutoBehavior].IsExpanded}">
<PathIcon Data="{StaticResource navigation_regular}" />
</ToggleButton>
<TextBlock Text="Wasabi Wallet" FontWeight="Bold" Foreground="White" VerticalAlignment="Center"/>

attempt 1 for binding toggle to behavior