diff --git a/Toolkit.Foundation/ComponentConfigurationViewModel.cs b/Toolkit.Foundation/ComponentConfigurationViewModel.cs index 45ac4f9..3bfe51e 100644 --- a/Toolkit.Foundation/ComponentConfigurationViewModel.cs +++ b/Toolkit.Foundation/ComponentConfigurationViewModel.cs @@ -4,8 +4,7 @@ namespace Toolkit.Foundation; public partial class ComponentConfigurationViewModel : ValueViewModel, - IComponentConfigurationViewModel, - INotificationHandler> + IComponentConfigurationViewModel where TConfiguration : class { public ComponentConfigurationViewModel(IServiceProvider provider, @@ -19,11 +18,6 @@ public partial class ComponentConfigurationViewModel args) - { - throw new NotImplementedException(); - } } public partial class ComponentConfigurationViewModel(IServiceProvider provider, diff --git a/Toolkit.UI.Avalonia/NamedTypeConverter.cs b/Toolkit.UI.Avalonia/NamedTypeConverter.cs index aa95356..1064078 100644 --- a/Toolkit.UI.Avalonia/NamedTypeConverter.cs +++ b/Toolkit.UI.Avalonia/NamedTypeConverter.cs @@ -8,16 +8,11 @@ public class NamedTypeConverter : MarkupExtension, IValueConverter { - public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) - { - var d = value is not null ? value.GetType().Name : (object?)null; - return d; - } + public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) => + value is not null ? value.GetType().Name : (object?)null; - public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) - { + public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException(); - } public override object ProvideValue(IServiceProvider serviceProvider) => this; } \ No newline at end of file diff --git a/Toolkit.UI.Avalonia/NavigationViewExtension.cs b/Toolkit.UI.Avalonia/NavigationViewExtension.cs index ccb7cba..aba1bee 100644 --- a/Toolkit.UI.Avalonia/NavigationViewExtension.cs +++ b/Toolkit.UI.Avalonia/NavigationViewExtension.cs @@ -27,15 +27,14 @@ public class NavigationViewExtension { if (sender.GetLogicalAncestors().OfType().FirstOrDefault() is NavigationView navigationView) { - void OnItemInvoked(object? _, FluentAvalonia.UI.Controls.NavigationViewItemInvokedEventArgs args) + sender.GetObservable(NavigationViewItem.IsSelectedProperty).Subscribe(args => { - if (args.InvokedItemContainer == sender) + if (args) { sender.RaiseEvent(new ItemInvokedEventArgs { RoutedEvent = ItemInvokedEvent }); } - } + }); - navigationView.ItemInvoked += OnItemInvoked; return true; } @@ -44,13 +43,12 @@ public class NavigationViewExtension if (!TrySetupNavigationView()) { - void OnAttachedToVisualTree(object? _, VisualTreeAttachmentEventArgs __) + void HandleLoaded(object? _, RoutedEventArgs __) { - sender.AttachedToVisualTree -= OnAttachedToVisualTree; TrySetupNavigationView(); } - sender.AttachedToVisualTree += OnAttachedToVisualTree; + sender.Loaded += HandleLoaded; } }