feat: update per review.

This commit is contained in:
Dong Bin
2025-07-08 15:11:38 +08:00
parent 85016c9e37
commit a0554d7add
2 changed files with 4 additions and 3 deletions

View File

@@ -5,7 +5,7 @@ namespace Ursa.Common;
public static class LogicalHelpers
{
public static int CalculateDistanceFromLogicalParent<T, TItem>(TItem? item, int @default = -1)
public static int CalculateDistanceFromLogicalParent<T, TItem>(TItem? item, int defaultValue = -1)
where T : class
where TItem : ILogical
{
@@ -16,6 +16,6 @@ public static class LogicalHelpers
if (logical is TItem) result++;
logical = logical.LogicalParent;
}
return item is not null ? result : @default;
return item is not null ? result : defaultValue;
}
}

View File

@@ -201,7 +201,8 @@ public class Anchor : ItemsControl
protected override void OnUnloaded(RoutedEventArgs e)
{
base.OnUnloaded(e);
TargetContainer?.RemoveHandler(UnloadedEvent, OnTargetContainerLoaded);
TargetContainer?.RemoveHandler(LoadedEvent, OnTargetContainerLoaded);
TargetContainer?.RemoveHandler(ScrollViewer.ScrollChangedEvent, OnScrollChanged);
}
private void OnTargetContainerLoaded(object? sender, RoutedEventArgs e)