Disable selection animation for now

This commit is contained in:
TheXamlGuy
2024-06-24 20:07:27 +01:00
parent 3f860eb537
commit fced830422
11 changed files with 56 additions and 21 deletions
+3 -1
View File
@@ -5,6 +5,8 @@ namespace Wallet.Avalonia;
public partial class AllNavigationView : public partial class AllNavigationView :
NavigationViewItem NavigationViewItem
{ {
public AllNavigationView() => public AllNavigationView()
{
InitializeComponent(); InitializeComponent();
}
} }
+3
View File
@@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using Toolkit.Avalonia; using Toolkit.Avalonia;
using Toolkit.Foundation; using Toolkit.Foundation;
using FluentAvalonia.Core;
namespace Wallet.Avalonia; namespace Wallet.Avalonia;
@@ -20,6 +21,8 @@ public partial class App : Application
public override void Initialize() public override void Initialize()
{ {
this.EnableHotReload(); this.EnableHotReload();
FAUISettings.SetAnimationsEnabledAtAppLevel(false);
AvaloniaXamlLoader.Load(this); AvaloniaXamlLoader.Load(this);
} }
+13 -1
View File
@@ -2,14 +2,23 @@
x:Class="Wallet.Avalonia.MainView" x:Class="Wallet.Avalonia.MainView"
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:vm="using:Wallet" xmlns:vm="using:Wallet"
x:DataType="vm:MainViewModel"> x:DataType="vm:MainViewModel">
<NavigationView <NavigationView
FooterMenuItemsSource="{Binding Footer}" FooterMenuItemsSource="{Binding Footer}"
IsSettingsVisible="False" IsSettingsVisible="False"
MenuItemTemplate="{Binding Template}" MenuItemTemplate="{Binding Template}"
MenuItemsSource="{Binding SelectedItem, Mode=TwoWay}" MenuItemsSource="{Binding SelectedItem}"
SelectionFollowsFocus="True"> SelectionFollowsFocus="True">
<Interaction.Behaviors>
<DataTriggerBehavior Binding="{ReflectionBinding SelectedItem.IsOpened}" Value="True">
<InvokeNavigationViewItemAction />
</DataTriggerBehavior>
<DataTriggerBehavior Binding="{ReflectionBinding SelectedItem.IsSelected}" Value="True">
<InvokeNavigationViewItemAction />
</DataTriggerBehavior>
</Interaction.Behaviors>
<NavigationView.PaneCustomContent> <NavigationView.PaneCustomContent>
<Grid RowDefinitions="*,Auto"> <Grid RowDefinitions="*,Auto">
<ListBox <ListBox
@@ -19,6 +28,9 @@
ItemTemplate="{ReflectionBinding Template}" ItemTemplate="{ReflectionBinding Template}"
ItemsSource="{Binding}" ItemsSource="{Binding}"
SelectedItem="{Binding SelectedItem}"> SelectedItem="{Binding SelectedItem}">
<ListBox.Resources>
<StaticResource x:Key="ListViewItemBackgroundSelected" ResourceKey="SubtleFillColorTransparentBrush" />
</ListBox.Resources>
<ListBox.Styles> <ListBox.Styles>
<Style Selector="ListBoxItem"> <Style Selector="ListBoxItem">
<Setter Property="MinWidth" Value="0" /> <Setter Property="MinWidth" Value="0" />
+1 -1
View File
@@ -25,7 +25,7 @@
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.1.0-rc1" /> <PackageReference Include="Avalonia.Fonts.Inter" Version="11.1.0-rc1" />
<PackageReference Include="Avalonia.Labs.Controls" Version="11.0.10.1" /> <PackageReference Include="Avalonia.Labs.Controls" Version="11.0.10.1" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" /> <PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="FluentAvaloniaUI" Version="2.1.0-preview5" /> <PackageReference Include="FluentAvaloniaUI" Version="2.1.0-preview6" />
<PackageReference Include="System.Reactive" Version="6.0.1" /> <PackageReference Include="System.Reactive" Version="6.0.1" />
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.1.0-rc1" /> <PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.1.0-rc1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0-preview.5.24306.7" /> <PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0-preview.5.24306.7" />
+1 -1
View File
@@ -14,7 +14,7 @@ public class CreateWalletHandler(IWalletFactory componentFactory,
{ {
if (args.Sender is Wallet <(string, string)> Wallet) if (args.Sender is Wallet <(string, string)> Wallet)
{ {
if (Wallet.Sender is (string name, string password) && if (Wallet.Value is (string name, string password) &&
name is { Length: > 0 } && name is { Length: > 0 } &&
password is { Length: > 0 }) password is { Length: > 0 })
{ {
+21 -9
View File
@@ -34,11 +34,17 @@ public abstract partial class FilterNavigationViewModel(IServiceProvider provide
return Task.CompletedTask; return Task.CompletedTask;
} }
public Task Handle(DeactivatedEventArgs<Wallet> args) => public Task Handle(DeactivatedEventArgs<Wallet> args)
Task.FromResult(IsActivated = false); {
IsActivated = false;
return Task.CompletedTask;
}
public Task Handle(ActivatedEventArgs<Wallet> args) => public Task Handle(ActivatedEventArgs<Wallet> args)
Task.FromResult(IsActivated = true); {
IsActivated = true;
return Task.CompletedTask;
}
} }
[Notification(typeof(NotifyEventArgs<Item<int>>), nameof(Value))] [Notification(typeof(NotifyEventArgs<Item<int>>), nameof(Value))]
@@ -58,14 +64,20 @@ public abstract partial class FilterNavigationViewModel<TWalletNavigation>(IServ
IWalletNavigationViewModel IWalletNavigationViewModel
{ {
[ObservableProperty] [ObservableProperty]
private bool activated; private bool isActivated;
[ObservableProperty] [ObservableProperty]
private bool isSelected; private bool isSelected;
public Task Handle(DeactivatedEventArgs<Wallet> args) => public Task Handle(DeactivatedEventArgs<Wallet> args)
Task.FromResult(Activated = false); {
IsActivated = false;
return Task.CompletedTask;
}
public Task Handle(ActivatedEventArgs<Wallet> args) => public Task Handle(ActivatedEventArgs<Wallet> args)
Task.FromResult(Activated = true); {
IsActivated = true;
return Task.CompletedTask;
}
} }
+1 -1
View File
@@ -13,7 +13,7 @@ public class OpenWalletHandler(IConfigurationDescriptor<WalletConfiguration> des
{ {
if (args.Sender is Wallet<string> Wallet && if (args.Sender is Wallet<string> Wallet &&
descriptor.Name is { Length: > 0 } name && descriptor.Name is { Length: > 0 } name &&
Wallet.Sender is { Length: > 0 } password) Wallet.Value is { Length: > 0 } password)
{ {
WalletConfiguration configuration = descriptor.Value; WalletConfiguration configuration = descriptor.Value;
if (configuration.Key?.Split(':') is { Length: >= 2 } keyPart) if (configuration.Key?.Split(':') is { Length: >= 2 } keyPart)
+1 -1
View File
@@ -14,7 +14,7 @@ public class QueryWalletHandler(IDbContextFactory<WalletContext> dbContextFactor
List<(Guid Id, string? Name, string Category, bool Favourite, bool Archived)> items = []; List<(Guid Id, string? Name, string Category, bool Favourite, bool Archived)> items = [];
if (args.Sender is Wallet<(string, string)> Wallet) if (args.Sender is Wallet<(string, string)> Wallet)
{ {
(string filter, string text) = Wallet.Sender; (string filter, string text) = Wallet.Value;
ExpressionStarter<ItemEntry> predicate = ExpressionStarter<ItemEntry> predicate =
PredicateBuilder.New<ItemEntry>(true); PredicateBuilder.New<ItemEntry>(true);
+1 -1
View File
@@ -1,5 +1,5 @@
namespace Wallet; namespace Wallet;
public record Wallet<TSender>(TSender Sender); public record Wallet<TValue>(TValue Value);
public record Wallet; public record Wallet;
+1 -1
View File
@@ -9,7 +9,7 @@ public class WalletActivatedHandler(IWalletHostCollection Wallets,
{ {
public Task Handle(ActivatedEventArgs<Wallet<IComponentHost>> args) public Task Handle(ActivatedEventArgs<Wallet<IComponentHost>> args)
{ {
if (args.Sender is Wallet<IComponentHost> wallet && wallet.Sender is IComponentHost host) if (args.Sender is Wallet<IComponentHost> wallet && wallet.Value is IComponentHost host)
{ {
List<IComponentHost> sortedWallets = [.. Wallets, host]; List<IComponentHost> sortedWallets = [.. Wallets, host];
sortedWallets = [.. sortedWallets.OrderBy(x => x.Services.GetRequiredService<IConfigurationDescriptor<WalletConfiguration>>() is sortedWallets = [.. sortedWallets.OrderBy(x => x.Services.GetRequiredService<IConfigurationDescriptor<WalletConfiguration>>() is
+10 -4
View File
@@ -65,9 +65,15 @@ public partial class WalletNavigationViewModel :
return Task.CompletedTask; return Task.CompletedTask;
} }
public Task Handle(DeactivatedEventArgs<Wallet> args) => public Task Handle(DeactivatedEventArgs<Wallet> args)
Task.FromResult(IsActivated = false); {
IsActivated = false;
return Task.CompletedTask;
}
public Task Handle(ActivatedEventArgs<Wallet> args) => public Task Handle(ActivatedEventArgs<Wallet> args)
Task.FromResult(IsActivated = true); {
IsActivated = true;
return Task.CompletedTask;
}
} }