Moved Add new item button
This commit is contained in:
@@ -116,6 +116,8 @@ public partial class App : Application
|
||||
services.AddHandler<OpenWalletHandler>();
|
||||
|
||||
services.AddTemplate<WalletNavigationViewModel, WalletNavigationView>();
|
||||
|
||||
services.AddTemplate<CreateItemNavigationViewModel, CreateItemNavigationView>();
|
||||
services.AddTemplate<AllNavigationViewModel, AllNavigationView>();
|
||||
services.AddTemplate<FavouritesNavigationViewModel, FavouritesNavigationView>();
|
||||
services.AddTemplate<CategoriesNavigationViewModel, CategoriesNavigationView>();
|
||||
@@ -133,7 +135,6 @@ public partial class App : Application
|
||||
|
||||
services.AddTemplate<WalletHeaderViewModel, WalletHeaderView>("WalletHeader");
|
||||
services.AddTemplate<BackActionViewModel, BackActionView>();
|
||||
services.AddTemplate<CreateItemActionViewModel, CreateItemActionView>();
|
||||
services.AddTemplate<SearchWalletActionViewModel, SearchWalletActionView>();
|
||||
|
||||
services.AddTemplate<ItemCategoryCollectionViewModel, ItemCategoryCollectionView>("ItemCategoryCollection");
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
<UserControl
|
||||
x:Class="Wallet.Avalonia.CreateItemActionView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Wallet"
|
||||
x:DataType="vm:CreateItemActionViewModel">
|
||||
<Button
|
||||
Height="32"
|
||||
MinWidth="144"
|
||||
HorizontalContentAlignment="Center"
|
||||
Classes="accent"
|
||||
CornerRadius="16"
|
||||
FontFamily="{DynamicResource SymbolThemeFontFamily}"
|
||||
ToolTip.Tip="New Item">
|
||||
<Grid ColumnDefinitions="Auto,8,*">
|
||||
<TextBlock
|
||||
Grid.Column="0"
|
||||
Margin="-6,3,0,0"
|
||||
FontFamily="{DynamicResource FluentThemeFontFamily}"
|
||||
FontSize="16"
|
||||
Foreground="{DynamicResource IconForegroundBrush}"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
Grid.Column="2"
|
||||
Margin="0,2,0,0"
|
||||
Foreground="{DynamicResource IconForegroundBrush}"
|
||||
Text="New Item" />
|
||||
</Grid>
|
||||
<Interaction.Behaviors>
|
||||
<EventTriggerBehavior EventName="Click">
|
||||
<NavigateAction Region="Left" Route="ItemCategoryCollection">
|
||||
<Parameter Key="Transition" Value="FromRight" />
|
||||
<Parameter Key="IsBackStackEnabled" Value="{x:True}" />
|
||||
</NavigateAction>
|
||||
<NavigateAction
|
||||
Region="{Binding Named, StringFormat='{}{0}:Content'}"
|
||||
Route="Item"
|
||||
Scope="self">
|
||||
<Parameter Key="FromCategory" Value="{x:True}" />
|
||||
<Parameter Key="State" Value="{x:Static vm:ItemState.New}" />
|
||||
</NavigateAction>
|
||||
</EventTriggerBehavior>
|
||||
</Interaction.Behaviors>
|
||||
</Button>
|
||||
</UserControl>
|
||||
@@ -1,8 +0,0 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Wallet.Avalonia;
|
||||
|
||||
public partial class CreateItemActionView : UserControl
|
||||
{
|
||||
public CreateItemActionView() => InitializeComponent();
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<NavigationViewItem
|
||||
x:Class="Wallet.Avalonia.CreateItemNavigationView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Wallet"
|
||||
x:DataType="vm:CreateItemNavigationViewModel"
|
||||
Content="New Item"
|
||||
NavigationViewExtension.IsItemInvokedEnabled="True"
|
||||
SelectsOnInvoked="False">
|
||||
<Interaction.Behaviors>
|
||||
<AttachedEventTriggerBehaviour RoutedEvent="{x:Static NavigationViewExtension.ItemInvokedEvent}">
|
||||
<NavigateAction Region="Left" Route="ItemCategoryCollection">
|
||||
<Parameter Key="Transition" Value="FromRight" />
|
||||
<Parameter Key="IsBackStackEnabled" Value="{x:True}" />
|
||||
<Parameter Key="ClearBackStack" Value="{x:True}" />
|
||||
</NavigateAction>
|
||||
<NavigateAction
|
||||
Region="{Binding Named, StringFormat='{}{0}:Content'}"
|
||||
Route="Item"
|
||||
Scope="self">
|
||||
<Parameter Key="FromCategory" Value="{x:True}" />
|
||||
<Parameter Key="State" Value="{x:Static vm:ItemState.New}" />
|
||||
</NavigateAction>
|
||||
</AttachedEventTriggerBehaviour>
|
||||
</Interaction.Behaviors>
|
||||
<NavigationViewItem.IconSource>
|
||||
<PathIconSource Data="F1 M 6 11.799999 C 6 11.666666 6.046666 11.546667 6.14 11.44 C 6.233333 11.333334 6.346666 11.280001 6.48 11.28 L 9.52 11.28 L 9.52 8.28 C 9.519999 8.146667 9.566666 8.033334 9.66 7.94 C 9.753333 7.846666 9.866667 7.799999 10 7.799999 C 10.133333 7.799999 10.253332 7.846666 10.36 7.94 C 10.466665 8.033334 10.519999 8.146667 10.52 8.28 L 10.52 11.28 L 13.52 11.28 C 13.653332 11.280001 13.766665 11.333334 13.86 11.44 C 13.953333 11.546667 14 11.666666 14 11.799999 C 14 11.933332 13.953333 12.046666 13.86 12.139999 C 13.766665 12.233334 13.653332 12.293333 13.52 12.32 L 10.52 12.32 L 10.52 15.279999 C 10.519999 15.44 10.466665 15.566667 10.36 15.66 C 10.253332 15.753333 10.133333 15.799999 10 15.799999 C 9.866667 15.799999 9.746666 15.753333 9.639999 15.66 C 9.533333 15.566667 9.48 15.453333 9.48 15.32 L 9.48 12.28 L 6.52 12.28 C 6.36 12.306667 6.233333 12.266666 6.14 12.16 C 6.046666 12.053333 6 11.933332 6 11.799999 Z M 10 19.799999 C 11.439999 19.799999 12.773333 19.439999 14 18.719999 C 15.226665 18 16.199999 17.026667 16.92 15.799999 C 17.639999 14.573334 18 13.24 18 11.799999 C 18 10.360001 17.639999 9.026667 16.92 7.799999 C 16.199999 6.573334 15.226665 5.6 14 4.879999 C 12.773333 4.16 11.439999 3.799999 10 3.799999 C 8.559999 3.799999 7.226666 4.16 6 4.879999 C 4.773333 5.6 3.8 6.573334 3.08 7.799999 C 2.36 9.026667 2 10.360001 2 11.799999 C 2 13.24 2.36 14.573334 3.08 15.799999 C 3.8 17.026667 4.773333 18 6 18.719999 C 7.226666 19.439999 8.559999 19.799999 10 19.799999 Z M 10 18.799999 C 8.719999 18.799999 7.546666 18.486666 6.48 17.859999 C 5.413333 17.233334 4.566667 16.386665 3.94 15.32 C 3.313333 14.253333 3 13.08 3 11.799999 C 3 10.52 3.313333 9.346666 3.94 8.28 C 4.566667 7.213333 5.413333 6.366667 6.48 5.74 C 7.546666 5.113333 8.719999 4.799999 10 4.799999 C 11.28 4.799999 12.453333 5.113333 13.52 5.74 C 14.586666 6.366667 15.433332 7.213333 16.059999 8.28 C 16.686666 9.346666 17 10.52 17 11.799999 C 17 13.08 16.686666 14.253333 16.059999 15.32 C 15.433332 16.386665 14.586666 17.233334 13.52 17.859999 C 12.453333 18.486666 11.28 18.799999 10 18.799999 Z " />
|
||||
</NavigationViewItem.IconSource>
|
||||
</NavigationViewItem>
|
||||
@@ -0,0 +1,10 @@
|
||||
using Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
namespace Wallet.Avalonia;
|
||||
|
||||
public partial class CreateItemNavigationView :
|
||||
NavigationViewItem
|
||||
{
|
||||
public CreateItemNavigationView() =>
|
||||
InitializeComponent();
|
||||
}
|
||||
@@ -24,21 +24,19 @@
|
||||
</NavigateAction>
|
||||
</AttachedEventTriggerBehaviour>
|
||||
</Interaction.Behaviors>
|
||||
<Grid Background="Transparent" ColumnDefinitions="Auto,*">
|
||||
<PersonPicture
|
||||
Grid.Column="0"
|
||||
Height="34"
|
||||
DisplayName="{Binding Name}" />
|
||||
<TextBlock
|
||||
Grid.Column="0"
|
||||
Margin="0,0,-2,10"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
FontFamily="{DynamicResource FluentThemeFontFamily}"
|
||||
FontSize="16"
|
||||
Foreground="{DynamicResource StarredIconForegroundBrush}"
|
||||
IsVisible="{Binding Favourite}"
|
||||
Text="" />
|
||||
<Grid Background="Transparent" ColumnDefinitions="40,*">
|
||||
<Grid Grid.Column="0">
|
||||
<PersonPicture Height="32" DisplayName="{Binding Name}" />
|
||||
<TextBlock
|
||||
Margin="0,0,2,12"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
FontFamily="{DynamicResource FluentThemeFontFamily}"
|
||||
FontSize="16"
|
||||
Foreground="{DynamicResource StarredIconForegroundBrush}"
|
||||
IsVisible="{Binding Favourite}"
|
||||
Text="" />
|
||||
</Grid>
|
||||
<StackPanel Grid.Column="1" Margin="12,12,6,12">
|
||||
<TextBlock FontWeight="SemiBold" Text="{Binding Name}" />
|
||||
<TextBlock Opacity="0.7" Text="{Binding Name}" />
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
SelectionFollowsFocus="True">
|
||||
<Interaction.Behaviors>
|
||||
<DataTriggerBehavior Binding="{ReflectionBinding SelectedItem.IsOpened}" Value="True">
|
||||
<InvokeNavigationViewItemAction />
|
||||
<InvokeNavigationViewItemAction SelectedIndex="1" />
|
||||
</DataTriggerBehavior>
|
||||
<DataTriggerBehavior Binding="{ReflectionBinding SelectedItem.IsSelected}" Value="True">
|
||||
<InvokeNavigationViewItemAction />
|
||||
<InvokeNavigationViewItemAction SelectedIndex="1" />
|
||||
</DataTriggerBehavior>
|
||||
</Interaction.Behaviors>
|
||||
<NavigationView.PaneCustomContent>
|
||||
@@ -34,6 +34,7 @@
|
||||
<ListBox.Styles>
|
||||
<Style Selector="ListBoxItem">
|
||||
<Setter Property="MinWidth" Value="0" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="Margin" Value="2,0,2,0" />
|
||||
</Style>
|
||||
</ListBox.Styles>
|
||||
|
||||
@@ -56,8 +56,8 @@
|
||||
<Compile Update="ItemCollectionView.axaml.cs">
|
||||
<DependentUpon>ItemCollectionView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="CreateItemActionView.axaml.cs">
|
||||
<DependentUpon>CreateItemActionView.axaml</DependentUpon>
|
||||
<Compile Update="CreateItemNavigationView.axaml.cs">
|
||||
<DependentUpon>CreateItemNavigationView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="ItemCommandHeaderView.axaml.cs">
|
||||
<DependentUpon>ItemCommandHeaderView.axaml</DependentUpon>
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
xmlns:ui="using:FluentAvalonia.UI.Controls"
|
||||
xmlns:vm="using:Wallet"
|
||||
x:DataType="vm:WalletNavigationViewModel"
|
||||
Content="{Binding Name}"
|
||||
ListBoxExtension.IsItemInvokedEnabled="True">
|
||||
<ListBoxItem.Resources>
|
||||
<SolidColorBrush x:Key="StarredIconForegroundBrush" Color="#FFEDB120" />
|
||||
</ListBoxItem.Resources>
|
||||
<Interaction.Behaviors>
|
||||
<DataTriggerBehavior Binding="{Binding IsOpened}" Value="False">
|
||||
<ConditionAction>
|
||||
@@ -33,4 +35,16 @@
|
||||
</ConditionAction>
|
||||
</AttachedEventTriggerBehaviour>
|
||||
</Interaction.Behaviors>
|
||||
</ListBoxItem>
|
||||
<Grid Margin="0,2,0,2" ColumnDefinitions="Auto, *">
|
||||
<Grid
|
||||
Grid.Column="0"
|
||||
Width="40"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
<PersonPicture Height="30" DisplayName="{Binding Name}" />
|
||||
</Grid>
|
||||
<Grid Grid.Column="1" Margin="{StaticResource NavigationViewItemContentPresenterMargin}">
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding Name}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ListBoxItem>
|
||||
@@ -3,16 +3,17 @@ using Toolkit.Foundation;
|
||||
|
||||
namespace Wallet;
|
||||
|
||||
public partial class CreateItemActionViewModel(IServiceProvider provider,
|
||||
public partial class CreateItemNavigationViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer,
|
||||
NamedComponent named) : Observable(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
NamedComponent named) : Observable(provider, factory, mediator, publisher, subscriber, disposer),
|
||||
IWalletNavigationViewModel
|
||||
{
|
||||
[ObservableProperty]
|
||||
private int index = 0;
|
||||
private bool isSelected;
|
||||
|
||||
[ObservableProperty]
|
||||
private string named = $"{named}";
|
||||
@@ -63,7 +63,6 @@ public partial class ItemCollectionViewModel :
|
||||
{
|
||||
Publisher.Publish(Notify.As(Factory.Create<WalletCommandHeaderCollection>(new List<IDisposable>
|
||||
{
|
||||
Factory.Create<CreateItemActionViewModel>(),
|
||||
Factory.Create<SearchWalletActionViewModel>(),
|
||||
})));
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ public partial class WalletNavigationViewModel :
|
||||
|
||||
public Task Handle(OpenedEventArgs<Wallet> args)
|
||||
{
|
||||
Add<CreateItemNavigationViewModel>();
|
||||
Add<AllNavigationViewModel>("All", 0);
|
||||
Add<FavouritesNavigationViewModel>("Favourites", 0);
|
||||
Add<ArchiveNavigationViewModel>("Archive", 0);
|
||||
|
||||
Reference in New Issue
Block a user