diff --git a/StabilityMatrix.Avalonia/Controls/FrameCarousel.axaml b/StabilityMatrix.Avalonia/Controls/FrameCarousel.axaml
index 5d062a39..fe399fce 100644
--- a/StabilityMatrix.Avalonia/Controls/FrameCarousel.axaml
+++ b/StabilityMatrix.Avalonia/Controls/FrameCarousel.axaml
@@ -16,6 +16,7 @@
CornerRadius="{TemplateBinding CornerRadius}">
diff --git a/StabilityMatrix.Avalonia/Controls/FrameCarousel.axaml.cs b/StabilityMatrix.Avalonia/Controls/FrameCarousel.axaml.cs
index 39887880..c6637b31 100644
--- a/StabilityMatrix.Avalonia/Controls/FrameCarousel.axaml.cs
+++ b/StabilityMatrix.Avalonia/Controls/FrameCarousel.axaml.cs
@@ -1,14 +1,10 @@
using System;
using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Specialized;
using System.Diagnostics.CodeAnalysis;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Controls.Templates;
-using Avalonia.Interactivity;
-using DynamicData.Binding;
using FluentAvalonia.UI.Controls;
using FluentAvalonia.UI.Media.Animation;
using FluentAvalonia.UI.Navigation;
@@ -67,24 +63,6 @@ public class FrameCarousel : SelectingItemsControl
TransitionInfoOverride = new SuppressNavigationTransitionInfo()
};
- private void ItemsView_CollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
- {
- if (frame is null) return;
-
- // If current size is 0, reset the frame cache
- var count = ItemCount;
- if (count == 0)
- {
- frame.ClearValue(Frame.CacheSizeProperty);
- // Setting this to false clears the page cache and stack caches
- frame.IsNavigationStackEnabled = false;
- }
- else
- {
- frame.SetValue(Frame.CacheSizeProperty, count);
- }
- }
-
///
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
@@ -95,32 +73,21 @@ public class FrameCarousel : SelectingItemsControl
frame.NavigationPageFactory = new FrameNavigationFactory(SourcePageType);
- ItemsView.CollectionChanged += ItemsView_CollectionChanged;
-
if (SelectedItem is not null)
{
frame.NavigateFromObject(SelectedItem, DirectionlessNavigationOptions);
}
}
- ///
- protected override void OnLoaded(RoutedEventArgs e)
- {
- base.OnLoaded(e);
-
- if (SelectedItem is not null)
- {
- frame!.NavigateFromObject(SelectedItem, DirectionlessNavigationOptions);
- }
- }
-
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
base.OnPropertyChanged(change);
- if (change.Property == SelectedItemProperty && frame is not null)
+ if (frame is null) return;
+
+ if (change.Property == SelectedItemProperty)
{
- var value = change.GetNewValue