break wallet navigation off into seperate view
This commit is contained in:
@@ -136,18 +136,18 @@ public partial class App : Application
|
||||
|
||||
services.AddTemplate<OpenWalletViewModel, OpenWalletView>("OpenWallet");
|
||||
|
||||
services.AddScoped<ItemCollectionConfiguration>();
|
||||
services.AddScoped<ItemNavigationCollectionConfiguration>();
|
||||
|
||||
services.AddTemplate<WalletViewModel, WalletView>("Wallet");
|
||||
services.AddTemplate<ItemCollectionViewModel, ItemCollectionView>("ItemCollection");
|
||||
services.AddTemplate<ItemNavigationCollectionViewModel, ItemNavigationCollectionView>("ItemCollection");
|
||||
|
||||
services.AddHandler<ItemCollectionViewModelActivatedHandler>();
|
||||
services.AddHandler<ItemNavigationCollectionViewModelActivatedHandler>();
|
||||
|
||||
services.AddTemplate<WalletHeaderViewModel, WalletHeaderView>("WalletHeader");
|
||||
services.AddTemplate<BackActionViewModel, BackActionView>();
|
||||
services.AddTemplate<SearchWalletActionViewModel, SearchWalletActionView>();
|
||||
|
||||
services.AddTemplate<ItemCategoryCollectionViewModel, ItemCategoryCollectionView>("ItemCategoryCollection");
|
||||
services.AddTemplate<ItemCategoryNavigationCollectionViewModel, ItemCategoryNavigationCollectionView>("ItemCategoryCollection");
|
||||
services.AddTemplate<ItemCategoryNavigationViewModel, ItemCategoryNavigationView>();
|
||||
|
||||
services.AddHandler<CategoriesNavigationViewModelActivationHandler>();
|
||||
@@ -231,7 +231,9 @@ public partial class App : Application
|
||||
services.AddHandler<CreateProfileImageHandler>();
|
||||
|
||||
services.AddTemplate<MainViewModel, MainView>("Main");
|
||||
services.AddHandler<MainViewModelActivationHandler>();
|
||||
services.AddHandler<WalletNavigationCollectionViewModelActivationHandler>();
|
||||
|
||||
services.AddTemplate<WalletNavigationCollectionViewModel, WalletNavigationCollectionView>("Wallets");
|
||||
|
||||
services.AddTransient<FooterViewModel>();
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Wallet.Avalonia;
|
||||
|
||||
public partial class ItemCategoryCollectionView :
|
||||
UserControl
|
||||
{
|
||||
public ItemCategoryCollectionView() =>
|
||||
InitializeComponent();
|
||||
}
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
<UserControl
|
||||
x:Class="Wallet.Avalonia.ItemCategoryCollectionView"
|
||||
x:Class="Wallet.Avalonia.ItemCategoryNavigationCollectionView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Wallet"
|
||||
x:DataType="vm:ItemCategoryCollectionViewModel">
|
||||
x:DataType="vm:ItemCategoryNavigationCollectionViewModel">
|
||||
<ListBox
|
||||
Margin="2,-1,0,0"
|
||||
AutoScrollToSelectedItem="True"
|
||||
@@ -0,0 +1,10 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Wallet.Avalonia;
|
||||
|
||||
public partial class ItemCategoryNavigationCollectionView :
|
||||
UserControl
|
||||
{
|
||||
public ItemCategoryNavigationCollectionView() =>
|
||||
InitializeComponent();
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Wallet.Avalonia;
|
||||
|
||||
public partial class ItemCollectionView :
|
||||
UserControl
|
||||
{
|
||||
public ItemCollectionView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
foo.SelectionChanged += Foo_SelectionChanged;
|
||||
}
|
||||
|
||||
private void Foo_SelectionChanged(object? sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
<UserControl
|
||||
x:Class="Wallet.Avalonia.ItemCollectionView"
|
||||
x:Class="Wallet.Avalonia.ItemNavigationCollectionView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Wallet"
|
||||
x:DataType="vm:ItemCollectionViewModel">
|
||||
x:DataType="vm:ItemNavigationCollectionViewModel">
|
||||
<Interaction.Behaviors>
|
||||
<AttachedBehaviour>
|
||||
<ConditionAction>
|
||||
@@ -0,0 +1,9 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Wallet.Avalonia;
|
||||
|
||||
public partial class ItemNavigationCollectionView :
|
||||
UserControl
|
||||
{
|
||||
public ItemNavigationCollectionView() => InitializeComponent();
|
||||
}
|
||||
+30
-156
@@ -10,8 +10,34 @@
|
||||
FooterMenuItemsSource="{Binding Footer}"
|
||||
IsSettingsVisible="False"
|
||||
MenuItemTemplate="{Binding Template}"
|
||||
MenuItemsSource="{Binding #ListBox.SelectedItem}">
|
||||
<Interaction.Behaviors>
|
||||
SelectedItem="{Binding SelectedItem}">
|
||||
<NavigationView.PaneCustomContent>
|
||||
<Grid RowDefinitions="*,Auto">
|
||||
<ContentControl Grid.Row="0">
|
||||
<Interaction.Behaviors>
|
||||
<AttachedBehaviour>
|
||||
<NavigateAction Region="{Binding $self}" Route="Wallets" />
|
||||
</AttachedBehaviour>
|
||||
</Interaction.Behaviors>
|
||||
</ContentControl>
|
||||
<NavigationViewItemSeparator Grid.Row="1" />
|
||||
</Grid>
|
||||
</NavigationView.PaneCustomContent>
|
||||
<NavigationView.Resources>
|
||||
<CornerRadius x:Key="NavigationViewContentGridCornerRadius">0</CornerRadius>
|
||||
<Thickness x:Key="NavigationViewContentGridBorderThickness">1,0,0,0</Thickness>
|
||||
</NavigationView.Resources>
|
||||
<Frame>
|
||||
<Interaction.Behaviors>
|
||||
<AttachedBehaviour>
|
||||
<NavigateRegionAction Name="Main">
|
||||
<NavigateAction Region="Main" Route="Wallet" />
|
||||
</NavigateRegionAction>
|
||||
</AttachedBehaviour>
|
||||
</Interaction.Behaviors>
|
||||
</Frame>
|
||||
|
||||
<!--<Interaction.Behaviors>
|
||||
<DataTriggerBehavior Binding="{ReflectionBinding SelectedItem.IsOpened}" Value="True">
|
||||
<InvokeNavigationViewItemAction SelectedIndex="1" />
|
||||
</DataTriggerBehavior>
|
||||
@@ -35,159 +61,7 @@
|
||||
</NavigationView.PaneHeader>
|
||||
<NavigationView.PaneCustomContent>
|
||||
<Grid RowDefinitions="*,Auto">
|
||||
<Overflow
|
||||
x:Name="ListBox"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Center"
|
||||
ItemTemplate="{ReflectionBinding Template}"
|
||||
ItemsSource="{Binding}"
|
||||
SelectedItem="{Binding SelectedItem, Mode=TwoWay}">
|
||||
<Overflow.Resources>
|
||||
<StaticResource x:Key="ListViewItemBackgroundSelected" ResourceKey="SubtleFillColorTransparentBrush" />
|
||||
<x:Double x:Key="WalletItemSize">40</x:Double>
|
||||
<CornerRadius x:Key="WalletItemCornerRadius">40</CornerRadius>
|
||||
<ControlTheme x:Key="{x:Type ListBoxItem}" TargetType="ListBoxItem">
|
||||
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
|
||||
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ListViewItemBackground}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource ListViewItemForeground}" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="Width" Value="{StaticResource WalletItemSize}" />
|
||||
<Setter Property="Height" Value="{StaticResource WalletItemSize}" />
|
||||
<Setter Property="MinHeight" Value="{StaticResource WalletItemSize}" />
|
||||
<Setter Property="MinWidth" Value="{StaticResource WalletItemSize}" />
|
||||
<Setter Property="CornerRadius" Value="{StaticResource WalletItemCornerRadius}" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Panel>
|
||||
<Border
|
||||
x:Name="PART_ContentBorder"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<Grid>
|
||||
<ContentPresenter
|
||||
Name="PART_ContentPresenter"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||
<Border
|
||||
Name="SelectionIndicator"
|
||||
BorderBrush="{DynamicResource AccentFillColorDefaultBrush}"
|
||||
BorderThickness="3"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
IsVisible="False"
|
||||
UseLayoutRounding="False" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Panel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
<Style Selector="^:disabled">
|
||||
<Setter Property="Opacity" Value="0.5" />
|
||||
</Style>
|
||||
<Style Selector="^:pointerover">
|
||||
<Style Selector="^ /template/ Border#PART_ContentBorder">
|
||||
<Setter Property="Background" Value="{DynamicResource ListViewItemBackgroundPointerOver}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ListViewItemForegroundPointerOver}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^:pressed">
|
||||
<Style Selector="^ /template/ Border#PART_ContentBorder">
|
||||
<Setter Property="Background" Value="{DynamicResource ListViewItemBackgroundPressed}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ListViewItemForegroundPressed}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^:selected">
|
||||
<Style Selector="^ /template/ Border#PART_ContentBorder">
|
||||
<Setter Property="Background" Value="{DynamicResource ListViewItemBackgroundSelected}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ListViewItemForegroundSelected}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ Border#SelectionIndicator">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
</Style>
|
||||
<Style Selector="^:not(:focus) /template/ Border#PART_ContentBorder">
|
||||
<Setter Property="Background" Value="{DynamicResource ListViewItemBackgroundSelected}" />
|
||||
</Style>
|
||||
<Style Selector="^:not(:focus) /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ListViewItemForegroundSelected}" />
|
||||
</Style>
|
||||
<Style Selector="^:pointerover">
|
||||
<Style Selector="^ /template/ Border#PART_ContentBorder">
|
||||
<Setter Property="Background" Value="{DynamicResource ListViewItemBackgroundSelectedPointerOver}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ListViewItemForegroundSelectedPointerOver}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ Border#SelectionIndicator">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ListViewItemSelectionIndicatorPointerOverBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^:pressed">
|
||||
<Style Selector="^ /template/ Border#PART_ContentBorder">
|
||||
<Setter Property="Background" Value="{DynamicResource ListViewItemBackgroundSelectedPressed}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ListViewItemForegroundSelectedPressed}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^:disabled /template/ Border#SelectionIndicator">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ListViewItemSelectionIndicatorDisabledBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</Overflow.Resources>
|
||||
<Overflow.Styles>
|
||||
<Style Selector="Overflow.Closed">
|
||||
<Setter Property="Margin" Value="1,2,1,0" />
|
||||
<Style Selector="^ StackPanel">
|
||||
<Setter Property="Orientation" Value="Vertical" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="Overflow.Opened">
|
||||
<Setter Property="Margin" Value="12,2,12,0" />
|
||||
<Style Selector="^ StackPanel">
|
||||
<Setter Property="Orientation" Value="Horizontal" />
|
||||
</Style>
|
||||
</Style>
|
||||
</Overflow.Styles>
|
||||
<Overflow.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Spacing="6" />
|
||||
</ItemsPanelTemplate>
|
||||
</Overflow.ItemsPanel>
|
||||
<Interaction.Behaviors>
|
||||
<DataTriggerBehavior Binding="{Binding $parent[NavigationView].IsPaneOpen}" Value="True">
|
||||
<AddClassAction ClassName="Opened" RemoveIfExists="True" />
|
||||
<RemoveClassAction ClassName="Closed" />
|
||||
</DataTriggerBehavior>
|
||||
<DataTriggerBehavior Binding="{Binding $parent[NavigationView].IsPaneOpen}" Value="False">
|
||||
<AddClassAction ClassName="Closed" RemoveIfExists="True" />
|
||||
<RemoveClassAction ClassName="Opened" />
|
||||
</DataTriggerBehavior>
|
||||
<DataTriggerBehavior Binding="{Binding #ListBox.SelectedItem, Converter={NamedTypeConverter}}" Value="WalletNavigationViewModel">
|
||||
<ChangePropertyAction
|
||||
PropertyName="SelectedItem"
|
||||
TargetObject="{Binding #NavigationView}"
|
||||
Value="{x:Null}" />
|
||||
</DataTriggerBehavior>
|
||||
<DataTriggerBehavior Binding="{Binding #NavigationView.SelectedItem, Converter={NamedTypeConverter}}" Value="ManageNavigationViewModel">
|
||||
<ChangePropertyAction
|
||||
PropertyName="SelectedItem"
|
||||
TargetObject="{Binding #ListBox}"
|
||||
Value="{x:Null}" />
|
||||
</DataTriggerBehavior>
|
||||
</Interaction.Behaviors>
|
||||
</Overflow>
|
||||
|
||||
<NavigationViewItemSeparator Grid.Row="1" />
|
||||
</Grid>
|
||||
</NavigationView.PaneCustomContent>
|
||||
@@ -203,7 +77,7 @@
|
||||
</NavigateRegionAction>
|
||||
</AttachedBehaviour>
|
||||
</Interaction.Behaviors>
|
||||
</Frame>
|
||||
</Frame>-->
|
||||
</NavigationView>
|
||||
</UserControl>
|
||||
|
||||
|
||||
@@ -50,11 +50,11 @@
|
||||
<Compile Update="ItemCategoryNavigationView.axaml.cs">
|
||||
<DependentUpon>ItemCategoryNavigationView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="ItemCategoryCollectionView.axaml.cs">
|
||||
<DependentUpon>ItemCategoryCollectionView.axaml</DependentUpon>
|
||||
<Compile Update="ItemCategoryNavigationCollectionView.axaml.cs">
|
||||
<DependentUpon>ItemCategoryNavigationCollectionView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="ItemCollectionView.axaml.cs">
|
||||
<DependentUpon>ItemCollectionView.axaml</DependentUpon>
|
||||
<Compile Update="ItemNavigationCollectionView.axaml.cs">
|
||||
<DependentUpon>ItemNavigationCollectionView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="CreateItemNavigationView.axaml.cs">
|
||||
<DependentUpon>CreateItemNavigationView.axaml</DependentUpon>
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
<UserControl
|
||||
x:Class="Wallet.Avalonia.WalletNavigationCollectionView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Wallet"
|
||||
x:DataType="vm:WalletNavigationCollectionViewModel">
|
||||
<Overflow
|
||||
HorizontalAlignment="Center"
|
||||
ItemTemplate="{ReflectionBinding Template}"
|
||||
ItemsSource="{Binding}"
|
||||
SelectedItem="{Binding SelectedItem, Mode=TwoWay}">
|
||||
<Overflow.Resources>
|
||||
<StaticResource x:Key="ListViewItemBackgroundSelected" ResourceKey="SubtleFillColorTransparentBrush" />
|
||||
<x:Double x:Key="WalletItemSize">40</x:Double>
|
||||
<CornerRadius x:Key="WalletItemCornerRadius">40</CornerRadius>
|
||||
<ControlTheme x:Key="{x:Type ListBoxItem}" TargetType="ListBoxItem">
|
||||
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
|
||||
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ListViewItemBackground}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource ListViewItemForeground}" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="Width" Value="{StaticResource WalletItemSize}" />
|
||||
<Setter Property="Height" Value="{StaticResource WalletItemSize}" />
|
||||
<Setter Property="MinHeight" Value="{StaticResource WalletItemSize}" />
|
||||
<Setter Property="MinWidth" Value="{StaticResource WalletItemSize}" />
|
||||
<Setter Property="CornerRadius" Value="{StaticResource WalletItemCornerRadius}" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Panel>
|
||||
<Border
|
||||
x:Name="PART_ContentBorder"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<Grid>
|
||||
<ContentPresenter
|
||||
Name="PART_ContentPresenter"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||
<Border
|
||||
Name="SelectionIndicator"
|
||||
BorderBrush="{DynamicResource AccentFillColorDefaultBrush}"
|
||||
BorderThickness="3"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
IsVisible="False"
|
||||
UseLayoutRounding="False" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Panel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
<Style Selector="^:disabled">
|
||||
<Setter Property="Opacity" Value="0.5" />
|
||||
</Style>
|
||||
<Style Selector="^:pointerover">
|
||||
<Style Selector="^ /template/ Border#PART_ContentBorder">
|
||||
<Setter Property="Background" Value="{DynamicResource ListViewItemBackgroundPointerOver}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ListViewItemForegroundPointerOver}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^:pressed">
|
||||
<Style Selector="^ /template/ Border#PART_ContentBorder">
|
||||
<Setter Property="Background" Value="{DynamicResource ListViewItemBackgroundPressed}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ListViewItemForegroundPressed}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^:selected">
|
||||
<Style Selector="^ /template/ Border#PART_ContentBorder">
|
||||
<Setter Property="Background" Value="{DynamicResource ListViewItemBackgroundSelected}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ListViewItemForegroundSelected}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ Border#SelectionIndicator">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
</Style>
|
||||
<Style Selector="^:not(:focus) /template/ Border#PART_ContentBorder">
|
||||
<Setter Property="Background" Value="{DynamicResource ListViewItemBackgroundSelected}" />
|
||||
</Style>
|
||||
<Style Selector="^:not(:focus) /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ListViewItemForegroundSelected}" />
|
||||
</Style>
|
||||
<Style Selector="^:pointerover">
|
||||
<Style Selector="^ /template/ Border#PART_ContentBorder">
|
||||
<Setter Property="Background" Value="{DynamicResource ListViewItemBackgroundSelectedPointerOver}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ListViewItemForegroundSelectedPointerOver}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ Border#SelectionIndicator">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ListViewItemSelectionIndicatorPointerOverBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^:pressed">
|
||||
<Style Selector="^ /template/ Border#PART_ContentBorder">
|
||||
<Setter Property="Background" Value="{DynamicResource ListViewItemBackgroundSelectedPressed}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ListViewItemForegroundSelectedPressed}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^:disabled /template/ Border#SelectionIndicator">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ListViewItemSelectionIndicatorDisabledBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</Overflow.Resources>
|
||||
<Overflow.Styles>
|
||||
<Style Selector="Overflow.Closed">
|
||||
<Setter Property="Margin" Value="1,2,1,0" />
|
||||
<Style Selector="^ StackPanel">
|
||||
<Setter Property="Orientation" Value="Vertical" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="Overflow.Opened">
|
||||
<Setter Property="Margin" Value="12,2,12,0" />
|
||||
<Style Selector="^ StackPanel">
|
||||
<Setter Property="Orientation" Value="Horizontal" />
|
||||
</Style>
|
||||
</Style>
|
||||
</Overflow.Styles>
|
||||
<Overflow.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Spacing="6" />
|
||||
</ItemsPanelTemplate>
|
||||
</Overflow.ItemsPanel>
|
||||
<Interaction.Behaviors>
|
||||
<DataTriggerBehavior Binding="{Binding $parent[NavigationView].IsPaneOpen}" Value="True">
|
||||
<AddClassAction ClassName="Opened" RemoveIfExists="True" />
|
||||
<RemoveClassAction ClassName="Closed" />
|
||||
</DataTriggerBehavior>
|
||||
<DataTriggerBehavior Binding="{Binding $parent[NavigationView].IsPaneOpen}" Value="False">
|
||||
<AddClassAction ClassName="Closed" RemoveIfExists="True" />
|
||||
<RemoveClassAction ClassName="Opened" />
|
||||
</DataTriggerBehavior>
|
||||
</Interaction.Behaviors>
|
||||
</Overflow>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,9 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Wallet.Avalonia;
|
||||
|
||||
public partial class WalletNavigationCollectionView :
|
||||
UserControl
|
||||
{
|
||||
public WalletNavigationCollectionView() => InitializeComponent();
|
||||
}
|
||||
+2
-2
@@ -3,8 +3,8 @@ using Toolkit.Foundation;
|
||||
|
||||
namespace Wallet;
|
||||
|
||||
[Notification(typeof(CreateEventArgs<ItemCategoryNavigationViewModel>), nameof(ItemCategoryCollectionViewModel))]
|
||||
public partial class ItemCategoryCollectionViewModel(IServiceProvider provider,
|
||||
[Notification(typeof(CreateEventArgs<ItemCategoryNavigationViewModel>), nameof(ItemCategoryNavigationCollectionViewModel))]
|
||||
public partial class ItemCategoryNavigationCollectionViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
@@ -16,7 +16,7 @@ public class ItemCategoryViewModelActivatedHandler(IItemConfigurationCollection
|
||||
configuration.Key, selected)
|
||||
is ItemCategoryNavigationViewModel viewModel)
|
||||
{
|
||||
publisher.Publish(Create.As(viewModel), nameof(ItemCategoryCollectionViewModel));
|
||||
publisher.Publish(Create.As(viewModel), nameof(ItemCategoryNavigationCollectionViewModel));
|
||||
selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class ItemCreatedHandler(IServiceProvider serviceProvider,
|
||||
decoratorService.Set(cachedItem);
|
||||
|
||||
publisher.Publish(Insert.As(index, viewModel),
|
||||
nameof(ItemCollectionViewModel));
|
||||
nameof(ItemNavigationCollectionViewModel));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public class ItemModifiedHandler(IServiceProvider serviceProvider,
|
||||
decoratorService.Set(newItem);
|
||||
|
||||
publisher.Publish(MoveTo.As<ItemNavigationViewModel>(oldIndex, newIndex),
|
||||
nameof(ItemCollectionViewModel));
|
||||
nameof(ItemNavigationCollectionViewModel));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
namespace Wallet;
|
||||
|
||||
public record ItemCollectionConfiguration
|
||||
public record ItemNavigationCollectionConfiguration
|
||||
{
|
||||
public string? Filter { get; set; } = "All";
|
||||
|
||||
@@ -3,11 +3,11 @@ using Toolkit.Foundation;
|
||||
|
||||
namespace Wallet;
|
||||
|
||||
[Notification(typeof(CreateEventArgs<ItemNavigationViewModel>), nameof(ItemCollectionViewModel))]
|
||||
[Notification(typeof(InsertEventArgs<ItemNavigationViewModel>), nameof(ItemCollectionViewModel))]
|
||||
[Notification(typeof(MoveToEventArgs<ItemNavigationViewModel>), nameof(ItemCollectionViewModel))]
|
||||
[Notification(typeof(NotifyEventArgs<Search<string>>), nameof(ItemCollectionViewModel))]
|
||||
public partial class ItemCollectionViewModel :
|
||||
[Notification(typeof(CreateEventArgs<ItemNavigationViewModel>), nameof(ItemNavigationCollectionViewModel))]
|
||||
[Notification(typeof(InsertEventArgs<ItemNavigationViewModel>), nameof(ItemNavigationCollectionViewModel))]
|
||||
[Notification(typeof(MoveToEventArgs<ItemNavigationViewModel>), nameof(ItemNavigationCollectionViewModel))]
|
||||
[Notification(typeof(NotifyEventArgs<Search<string>>), nameof(ItemNavigationCollectionViewModel))]
|
||||
public partial class ItemNavigationCollectionViewModel :
|
||||
ObservableCollection<ItemNavigationViewModel>,
|
||||
INotificationHandler<NotifyEventArgs<Filter>>,
|
||||
INotificationHandler<NotifyEventArgs<Search<string>>>,
|
||||
@@ -16,9 +16,9 @@ public partial class ItemCollectionViewModel :
|
||||
[ObservableProperty]
|
||||
public string? named;
|
||||
|
||||
private ItemCollectionConfiguration configuration;
|
||||
private ItemNavigationCollectionConfiguration configuration;
|
||||
|
||||
public ItemCollectionViewModel(IServiceProvider provider,
|
||||
public ItemNavigationCollectionViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
@@ -26,7 +26,7 @@ public partial class ItemCollectionViewModel :
|
||||
IDisposer disposer,
|
||||
IContentTemplate template,
|
||||
NamedComponent named,
|
||||
ItemCollectionConfiguration configuration,
|
||||
ItemNavigationCollectionConfiguration configuration,
|
||||
string? filter = null) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
Template = template;
|
||||
@@ -70,5 +70,5 @@ public partial class ItemCollectionViewModel :
|
||||
}
|
||||
|
||||
protected override ActivationBuilder ActivationBuilder() =>
|
||||
new(Activation.As<ItemNavigationViewModel, ItemCollectionConfiguration>(configuration));
|
||||
new(Activation.As<ItemNavigationViewModel, ItemNavigationCollectionConfiguration>(configuration));
|
||||
}
|
||||
+5
-5
@@ -3,16 +3,16 @@ using Toolkit.Foundation;
|
||||
|
||||
namespace Wallet;
|
||||
|
||||
public class ItemCollectionViewModelActivatedHandler(IMediator mediator,
|
||||
public class ItemNavigationCollectionViewModelActivatedHandler(IMediator mediator,
|
||||
IServiceProvider serviceProvider,
|
||||
ICache<Item<(Guid, string)>> cache,
|
||||
IPublisher publisher) :
|
||||
INotificationHandler<ActivationEventArgs<ItemNavigationViewModel, ItemCollectionConfiguration>>
|
||||
INotificationHandler<ActivationEventArgs<ItemNavigationViewModel, ItemNavigationCollectionConfiguration>>
|
||||
{
|
||||
public async Task Handle(ActivationEventArgs<ItemNavigationViewModel,
|
||||
ItemCollectionConfiguration> args)
|
||||
ItemNavigationCollectionConfiguration> args)
|
||||
{
|
||||
if (args.Value is ItemCollectionConfiguration configuration)
|
||||
if (args.Value is ItemNavigationCollectionConfiguration configuration)
|
||||
{
|
||||
cache.Clear();
|
||||
bool selected = true;
|
||||
@@ -40,7 +40,7 @@ public class ItemCollectionViewModelActivatedHandler(IMediator mediator,
|
||||
decoratorService.Set(item);
|
||||
cache.Add(item);
|
||||
|
||||
publisher.Publish(Create.As(viewModel), nameof(ItemCollectionViewModel));
|
||||
publisher.Publish(Create.As(viewModel), nameof(ItemNavigationCollectionViewModel));
|
||||
}
|
||||
|
||||
selected = false;
|
||||
+13
-6
@@ -1,14 +1,11 @@
|
||||
using Avalonia.Xaml.Interactions.Core;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Wallet;
|
||||
|
||||
[Notification(typeof(CreateEventArgs<IMainNavigationViewModel>), nameof(MainViewModel))]
|
||||
[Notification(typeof(InsertEventArgs<IMainNavigationViewModel>), nameof(MainViewModel))]
|
||||
public partial class MainViewModel :
|
||||
ObservableCollection<IMainNavigationViewModel>
|
||||
ObservableCollection<IMainNavigationViewModel>,
|
||||
INotificationHandler<SelectionEventArgs<IWalletNavigationViewModel>>
|
||||
{
|
||||
[ObservableProperty]
|
||||
private FooterViewModel footer;
|
||||
@@ -27,4 +24,14 @@ public partial class MainViewModel :
|
||||
}
|
||||
|
||||
public IContentTemplate Template { get; set; }
|
||||
|
||||
public Task Handle(SelectionEventArgs<IWalletNavigationViewModel> args)
|
||||
{
|
||||
if (args.Sender is not null)
|
||||
{
|
||||
SelectedItem = null;
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -16,5 +16,5 @@ public partial class SearchWalletActionViewModel(IServiceProvider provider,
|
||||
|
||||
[RelayCommand]
|
||||
private void Invoke() => Publisher.Publish(Notify.As(new Search<string>(Value)),
|
||||
nameof(ItemCollectionViewModel));
|
||||
nameof(ItemNavigationCollectionViewModel));
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class WalletActivatedHandler(IWalletHostCollection wallets,
|
||||
descriptor.Name, profileImage?.Value, false)
|
||||
is WalletNavigationViewModel viewModel)
|
||||
{
|
||||
publisher.Publish(Insert.As<IMainNavigationViewModel>(index, viewModel),
|
||||
publisher.Publish(Insert.As<IWalletNavigationViewModel>(index, viewModel),
|
||||
nameof(MainViewModel));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Wallet;
|
||||
|
||||
[Notification(typeof(CreateEventArgs<IWalletNavigationViewModel>), nameof(WalletNavigationCollectionViewModel))]
|
||||
[Notification(typeof(InsertEventArgs<IWalletNavigationViewModel>), nameof(WalletNavigationCollectionViewModel))]
|
||||
public partial class WalletNavigationCollectionViewModel :
|
||||
ObservableCollection<IWalletNavigationViewModel>,
|
||||
INotificationHandler<SelectionEventArgs<IMainNavigationViewModel>>
|
||||
{
|
||||
public WalletNavigationCollectionViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer,
|
||||
IContentTemplate template) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
Template = template;
|
||||
}
|
||||
|
||||
public IContentTemplate Template { get; set; }
|
||||
|
||||
public Task Handle(SelectionEventArgs<IMainNavigationViewModel> args)
|
||||
{
|
||||
if (args.Sender is not null)
|
||||
{
|
||||
SelectedItem = null;
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -3,11 +3,11 @@ using Toolkit.Foundation;
|
||||
|
||||
namespace Wallet;
|
||||
|
||||
public class MainViewModelActivationHandler(IPublisher publisher,
|
||||
public class WalletNavigationCollectionViewModelActivationHandler(IPublisher publisher,
|
||||
IWalletHostCollection Wallets) :
|
||||
INotificationHandler<ActivationEventArgs<IMainNavigationViewModel>>
|
||||
INotificationHandler<ActivationEventArgs<IWalletNavigationViewModel>>
|
||||
{
|
||||
public Task Handle(ActivationEventArgs<IMainNavigationViewModel> args)
|
||||
public Task Handle(ActivationEventArgs<IWalletNavigationViewModel> args)
|
||||
{
|
||||
bool selected = true;
|
||||
|
||||
@@ -42,8 +42,8 @@ public class MainViewModelActivationHandler(IPublisher publisher,
|
||||
if (factory.Create<WalletNavigationViewModel>(args => args.Initialize(), configuration.Name, profileImage?.Value ?? null, selected)
|
||||
is WalletNavigationViewModel viewModel)
|
||||
{
|
||||
publisher.Publish(Create.As<IMainNavigationViewModel>(viewModel),
|
||||
nameof(MainViewModel));
|
||||
publisher.Publish(Create.As<IWalletNavigationViewModel>(viewModel),
|
||||
nameof(WalletNavigationCollectionViewModel));
|
||||
|
||||
selected = false;
|
||||
}
|
||||
@@ -6,7 +6,7 @@ namespace Wallet;
|
||||
|
||||
public partial class WalletNavigationViewModel :
|
||||
ObservableCollection<IWalletNavigationViewModel>,
|
||||
IMainNavigationViewModel,
|
||||
IWalletNavigationViewModel,
|
||||
INotificationHandler<OpenedEventArgs<Wallet>>,
|
||||
INotificationHandler<ClosedEventArgs<Wallet>>,
|
||||
INotificationHandler<ActivatedEventArgs<Wallet>>,
|
||||
@@ -52,11 +52,11 @@ public partial class WalletNavigationViewModel :
|
||||
|
||||
public Task Handle(OpenedEventArgs<Wallet> args)
|
||||
{
|
||||
Add<CreateItemNavigationViewModel>();
|
||||
Add<AllNavigationViewModel>("All", 0);
|
||||
Add<FavouritesNavigationViewModel>("Favourites", 0);
|
||||
Add<ArchiveNavigationViewModel>("Archive", 0);
|
||||
Add<CategoriesNavigationViewModel>("Categories", 0);
|
||||
//Add<CreateItemNavigationViewModel>();
|
||||
//Add<AllNavigationViewModel>("All", 0);
|
||||
//Add<FavouritesNavigationViewModel>("Favourites", 0);
|
||||
//Add<ArchiveNavigationViewModel>("Archive", 0);
|
||||
//Add<CategoriesNavigationViewModel>("Categories", 0);
|
||||
|
||||
IsOpened = true;
|
||||
Publisher.Publish(Changed.As<Item>());
|
||||
|
||||
Reference in New Issue
Block a user