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 :
NavigationViewItem
{
public AllNavigationView() =>
public AllNavigationView()
{
InitializeComponent();
}
}
+3
View File
@@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Linq;
using Toolkit.Avalonia;
using Toolkit.Foundation;
using FluentAvalonia.Core;
namespace Wallet.Avalonia;
@@ -20,6 +21,8 @@ public partial class App : Application
public override void Initialize()
{
this.EnableHotReload();
FAUISettings.SetAnimationsEnabledAtAppLevel(false);
AvaloniaXamlLoader.Load(this);
}
+13 -1
View File
@@ -2,14 +2,23 @@
x:Class="Wallet.Avalonia.MainView"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:vm="using:Wallet"
x:DataType="vm:MainViewModel">
<NavigationView
FooterMenuItemsSource="{Binding Footer}"
IsSettingsVisible="False"
MenuItemTemplate="{Binding Template}"
MenuItemsSource="{Binding SelectedItem, Mode=TwoWay}"
MenuItemsSource="{Binding SelectedItem}"
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>
<Grid RowDefinitions="*,Auto">
<ListBox
@@ -19,6 +28,9 @@
ItemTemplate="{ReflectionBinding Template}"
ItemsSource="{Binding}"
SelectedItem="{Binding SelectedItem}">
<ListBox.Resources>
<StaticResource x:Key="ListViewItemBackgroundSelected" ResourceKey="SubtleFillColorTransparentBrush" />
</ListBox.Resources>
<ListBox.Styles>
<Style Selector="ListBoxItem">
<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.Labs.Controls" Version="11.0.10.1" />
<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="Avalonia.Xaml.Behaviors" Version="11.1.0-rc1" />
<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 (Wallet.Sender is (string name, string password) &&
if (Wallet.Value is (string name, string password) &&
name is { Length: > 0 } &&
password is { Length: > 0 })
{
+22 -10
View File
@@ -34,11 +34,17 @@ public abstract partial class FilterNavigationViewModel(IServiceProvider provide
return Task.CompletedTask;
}
public Task Handle(DeactivatedEventArgs<Wallet> args) =>
Task.FromResult(IsActivated = false);
public Task Handle(DeactivatedEventArgs<Wallet> args)
{
IsActivated = false;
return Task.CompletedTask;
}
public Task Handle(ActivatedEventArgs<Wallet> args) =>
Task.FromResult(IsActivated = true);
public Task Handle(ActivatedEventArgs<Wallet> args)
{
IsActivated = true;
return Task.CompletedTask;
}
}
[Notification(typeof(NotifyEventArgs<Item<int>>), nameof(Value))]
@@ -58,14 +64,20 @@ public abstract partial class FilterNavigationViewModel<TWalletNavigation>(IServ
IWalletNavigationViewModel
{
[ObservableProperty]
private bool activated;
private bool isActivated;
[ObservableProperty]
private bool isSelected;
public Task Handle(DeactivatedEventArgs<Wallet> args) =>
Task.FromResult(Activated = false);
public Task Handle(ActivatedEventArgs<Wallet> args) =>
Task.FromResult(Activated = true);
public Task Handle(DeactivatedEventArgs<Wallet> args)
{
IsActivated = false;
return Task.CompletedTask;
}
public Task Handle(ActivatedEventArgs<Wallet> args)
{
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 &&
descriptor.Name is { Length: > 0 } name &&
Wallet.Sender is { Length: > 0 } password)
Wallet.Value is { Length: > 0 } password)
{
WalletConfiguration configuration = descriptor.Value;
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 = [];
if (args.Sender is Wallet<(string, string)> Wallet)
{
(string filter, string text) = Wallet.Sender;
(string filter, string text) = Wallet.Value;
ExpressionStarter<ItemEntry> predicate =
PredicateBuilder.New<ItemEntry>(true);
+1 -1
View File
@@ -1,5 +1,5 @@
namespace Wallet;
public record Wallet<TSender>(TSender Sender);
public record Wallet<TValue>(TValue Value);
public record Wallet;
+1 -1
View File
@@ -9,7 +9,7 @@ public class WalletActivatedHandler(IWalletHostCollection Wallets,
{
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];
sortedWallets = [.. sortedWallets.OrderBy(x => x.Services.GetRequiredService<IConfigurationDescriptor<WalletConfiguration>>() is
+11 -5
View File
@@ -65,9 +65,15 @@ public partial class WalletNavigationViewModel :
return Task.CompletedTask;
}
public Task Handle(DeactivatedEventArgs<Wallet> args) =>
Task.FromResult(IsActivated = false);
public Task Handle(ActivatedEventArgs<Wallet> args) =>
Task.FromResult(IsActivated = true);
public Task Handle(DeactivatedEventArgs<Wallet> args)
{
IsActivated = false;
return Task.CompletedTask;
}
public Task Handle(ActivatedEventArgs<Wallet> args)
{
IsActivated = true;
return Task.CompletedTask;
}
}