Add actions list box
MODIFY
WalletWasabi.Fluent/ViewModels/NavBar/NavBarViewModel.cs
WalletWasabi.Fluent/ViewModels/NavBar/NavBarViewModel.cs
@@ -74,6 +74,8 @@ namespace WalletWasabi.Fluent.ViewModels.NavBar
});
}
+ public ObservableCollection<NavBarItemViewModel> Actions => _walletManager.Actions;
+
public ObservableCollection<NavBarItemViewModel> Items => _walletManager.Items;
public NavBarItemViewModel? SelectedItem

MODIFY
WalletWasabi.Fluent/ViewModels/WalletManagerViewModel.cs
WalletWasabi.Fluent/ViewModels/WalletManagerViewModel.cs
@@ -21,6 +21,7 @@ namespace WalletWasabi.Fluent.ViewModels
[AutoNotify] private WalletViewModelBase? _selectedWallet;
[AutoNotify] private bool _loggedInAndSelectedAlwaysFirst;
[AutoNotify] private ObservableCollection<NavBarItemViewModel> _items;
+ [AutoNotify] private ObservableCollection<NavBarItemViewModel> _actions;
[AutoNotify] private ObservableCollection<WalletViewModelBase> _wallets;
[AutoNotify] private bool _anyWalletStarted;
@@ -30,6 +31,7 @@ namespace WalletWasabi.Fluent.ViewModels
_walletDictionary = new Dictionary<Wallet, WalletViewModelBase>();
_walletActionsDictionary = new Dictionary<WalletViewModelBase, List<NavBarItemViewModel>>();
_items = new ObservableCollection<NavBarItemViewModel>();
+ _actions = new ObservableCollection<NavBarItemViewModel>();
_wallets = new ObservableCollection<WalletViewModelBase>();
_loggedInAndSelectedAlwaysFirst = true;
@@ -145,7 +147,8 @@ namespace WalletWasabi.Fluent.ViewModels
return;
}
- if (SelectedWallet is WalletViewModelBase walletViewModelPrevious && walletViewModelPrevious.Wallet.IsLoggedIn)
+ if (SelectedWallet is WalletViewModelBase walletViewModelPrevious && walletViewModelPrevious.Wallet.IsLoggedIn
+ && item is WalletViewModelBase walletViewModel && walletViewModel.Wallet.IsLoggedIn)
{
if (item is WalletViewModelBase && SelectedWallet != item)
{
@@ -194,6 +197,7 @@ namespace WalletWasabi.Fluent.ViewModels
private void InsertActions(WalletViewModelBase walletViewModel, List<NavBarItemViewModel> result)
{
// Insert current lodged in wallet at the top of the items list.
+#if false
if (_loggedInAndSelectedAlwaysFirst)
{
_items.Remove(walletViewModel);
@@ -202,12 +206,16 @@ namespace WalletWasabi.Fluent.ViewModels
_wallets.Remove(walletViewModel);
_wallets.Insert(0, walletViewModel);
}
-
+#else
+ _items.Remove(walletViewModel);
+ _actions.Add(walletViewModel);
+#endif
var index = _wallets.IndexOf(walletViewModel);
if (index >= 0)
{
var insertIndex = index;
// Add top separator only when wallet is not first item.
+#if false
if (index > 0)
{
var topSeparator = new SeparatorItemViewModel();
@@ -215,16 +223,21 @@ namespace WalletWasabi.Fluent.ViewModels
result.Add(topSeparator);
insertIndex += 1;
}
-
+#endif
var actions = GetWalletActions(walletViewModel);
for (var i = 0; i < actions.Count; i++)
{
var action = actions[i];
+#if false
_items.Insert(insertIndex + i + 1, action);
result.Add(action);
+#else
+ _actions.Add(action);
+ result.Add(action);
+#endif
}
-
+#if false
// Add bottom separator only when wallet is not first or last item.
if (_wallets.Count > 1 && index != _wallets.Count - 1)
{
@@ -232,6 +245,7 @@ namespace WalletWasabi.Fluent.ViewModels
_items.Insert(insertIndex + actions.Count + 1, bottomSeparator);
result.Add(bottomSeparator);
}
+#endif
}
}
@@ -239,9 +253,18 @@ namespace WalletWasabi.Fluent.ViewModels
{
var actions = _walletActionsDictionary[wallet];
+#if true
+ _actions.Remove(wallet);
+ _items.Insert(0, wallet);
+#endif
+
foreach (var action in actions)
{
+#if false
_items.Remove(action);
+#else
+ _actions.Remove(action);
+#endif
}
actions.Clear();

MODIFY
WalletWasabi.Fluent/Views/NavBar/NavBar.axaml
WalletWasabi.Fluent/Views/NavBar/NavBar.axaml
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="WalletWasabi.Fluent.Views.NavBar.NavBar" UseLayoutRounding="False">
<UserControl.Styles>
- <Style Selector=":is(ListBox)">
+ <!--<Style Selector=":is(ListBox)">
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate x:DataType="vm:NavBarItemViewModel">
</DataTemplate>
</Setter.Value>
</Setter>
- </Style>
+ </Style>-->
<Style Selector=":is(ListBox).bottom">
<Setter Property="ItemsPanel">
<Setter.Value>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
- <Setter Property="ItemTemplate">
+ <!--<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate x:DataType="vm:NavBarItemViewModel">
<Panel Width="45" Background="Transparent" HorizontalAlignment="Center" ToolTip.Tip="{Binding Title}">
</Panel>
</DataTemplate>
</Setter.Value>
- </Setter>
+ </Setter>-->
</Style>
<Style Selector="PathIcon">
<Setter Property="Margin" Value="13 0 0 0" />
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" x:CompileBindings="False" />
</Style>
</c:NavBarListBox.Styles>
+ <c:NavBarListBox.ItemTemplate>
+ <DataTemplate x:DataType="vm:NavBarItemViewModel">
+ <Panel>
+ <Panel Width="45" HorizontalAlignment="Left">
+ <PathIcon HorizontalAlignment="Left">
+ <PathIcon.Data>
+ <Binding Path="IconName" Converter="{x:Static conv:NavBarIconConverter.Instance}" />
+ </PathIcon.Data>
+ </PathIcon>
+ </Panel>
+ <TextBlock Text="{Binding Title}" Margin="55 0 0 0" />
+ </Panel>
+ </DataTemplate>
+ </c:NavBarListBox.ItemTemplate>
</c:NavBarListBox>
<Separator />
+ <c:NavBarListBox Items="{Binding Actions}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}">
+ <c:NavBarListBox.Styles>
+ <Style Selector="c|NavBarItem">
+ <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" x:CompileBindings="False" />
+ </Style>
+ </c:NavBarListBox.Styles>
+ <c:NavBarListBox.DataTemplates>
+ <DataTemplate DataType="vmw:WalletViewModelBase" x:CompileBindings="False">
+ <Panel>
+ <Panel Width="45" HorizontalAlignment="Left">
+ <PathIcon HorizontalAlignment="Left">
+ <PathIcon.Data>
+ <Binding Path="IconName" Converter="{x:Static conv:NavBarIconConverter.Instance}" />
+ </PathIcon.Data>
+ </PathIcon>
+ <Ellipse DataContext="{Binding Wallet}" IsVisible="{Binding IsLoggedIn}" Width="9" Height="9" Margin="15,13,0,0" Fill="#F2994A"/>
+ </Panel>
+ <TextBlock Text="{Binding Title}" Margin="55 0 0 0" />
+ </Panel>
+ </DataTemplate>
+ <DataTemplate DataType="vmwa:WalletActionViewModel" x:CompileBindings="False">
+ <Panel>
+ <Panel Width="45" HorizontalAlignment="Left">
+ <PathIcon HorizontalAlignment="Left">
+ <PathIcon.Data>
+ <Binding Path="IconName" Converter="{x:Static conv:NavBarIconConverter.Instance}" />
+ </PathIcon.Data>
+ </PathIcon>
+ </Panel>
+ <TextBlock Text="{Binding Title}" Margin="55 0 0 0" />
+ </Panel>
+ </DataTemplate>
+ </c:NavBarListBox.DataTemplates>
+ </c:NavBarListBox>
+ <Separator IsVisible="{Binding !!Actions.Count}" />
</StackPanel>
-
<StackPanel DockPanel.Dock="Bottom">
<Separator />
<c:NavBarListBox Classes="bottom" Items="{Binding BottomItems}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" >
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" x:CompileBindings="False" />
</Style>
</c:NavBarListBox.Styles>
+ <c:NavBarListBox.ItemTemplate>
+ <DataTemplate x:DataType="vm:NavBarItemViewModel">
+ <Panel Width="45" Background="Transparent" HorizontalAlignment="Center" ToolTip.Tip="{Binding Title}">
+ <i:Interaction.Behaviors>
+ <ia:EventTriggerBehavior EventName="PointerPressed" SourceObject="{Binding $parent[c:NavBarItem]}">
+ <ia:InvokeCommandAction Command="{Binding OpenCommand}" CommandParameter="{x:Static rx:Unit.Default}" />
+ </ia:EventTriggerBehavior>
+ </i:Interaction.Behaviors>
+ <PathIcon HorizontalAlignment="Left">
+ <PathIcon.Data>
+ <Binding Path="IconName" Converter="{x:Static conv:NavBarIconConverter.Instance}" />
+ </PathIcon.Data>
+ </PathIcon>
+ </Panel>
+ </DataTemplate>
+ </c:NavBarListBox.ItemTemplate>
</c:NavBarListBox>
</StackPanel>
-
+ <c:NavBarListBox Items="{Binding Items}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" VerticalAlignment="{Binding Actions.Count, Mode=OneWay, Converter={x:Static conv:NavBarItemsListBoxAlignmentConverter.Instance}}">
+ <c:NavBarListBox.Styles>
+ <Style Selector="c|NavBarItem">
+ <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" x:CompileBindings="False" />
+ </Style>
+ </c:NavBarListBox.Styles>
+ <c:NavBarListBox.DataTemplates>
+ <DataTemplate DataType="vmw:WalletViewModelBase" x:CompileBindings="False">
+ <Panel>
+ <Panel Width="45" HorizontalAlignment="Left">
+ <PathIcon HorizontalAlignment="Left">
+ <PathIcon.Data>
+ <Binding Path="IconName" Converter="{x:Static conv:NavBarIconConverter.Instance}" />
+ </PathIcon.Data>
+ </PathIcon>
+ <Ellipse DataContext="{Binding Wallet}" IsVisible="{Binding IsLoggedIn}" Width="9" Height="9" Margin="15,13,0,0" Fill="#F2994A"/>
+ </Panel>
+ <TextBlock Text="{Binding Title}" Margin="55 0 0 0" />
+ </Panel>
+ </DataTemplate>
+ </c:NavBarListBox.DataTemplates>
+ </c:NavBarListBox>
+ <!--
<c:NavBarTreeView Items="{Binding Items}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" AutoScrollToSelectedItem="True" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<c:NavBarTreeView.Styles>
<Style Selector="c|NavBarTreeItem">
</DataTemplate>
</c:NavBarTreeView.DataTemplates>
</c:NavBarTreeView>
+ -->
</DockPanel>
</UserControl>
\ No newline at end of file

Add actions list box