Skip to content

Commit

Permalink
Merge pull request #45 from AndrewKeepCoding/44-scrollbarextensions-s…
Browse files Browse the repository at this point in the history
…crollbar-looses-expanded-display-mode-on-page-reload

Fix bug that ScrollBarExtensions' KeepExpanded doesn't work with cashed pages.
  • Loading branch information
AndrewKeepCoding authored Apr 13, 2023
2 parents d4010a5 + d46e51b commit 16062ac
Showing 1 changed file with 0 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ private static void OnKeepExpandedPropertyChanged(FrameworkElement keepExpandedT

keepExpandedTarget.Loaded -= KeepExpandedTarget_Loaded;
keepExpandedTarget.Loaded += KeepExpandedTarget_Loaded;
keepExpandedTarget.Unloaded -= KeepExpandedTarget_Unloaded;
keepExpandedTarget.Unloaded += KeepExpandedTarget_Unloaded;

ApplyKeepExpanded(keepExpandedTarget, orientation, keepExpanded);
}
Expand All @@ -36,18 +34,6 @@ private static void KeepExpandedTarget_Loaded(object sender, RoutedEventArgs e)
}
}

private static void KeepExpandedTarget_Unloaded(object sender, RoutedEventArgs e)
{
Log($"KeepExpandedTarget_Unloaded sender: {sender}");

if (sender is FrameworkElement target)
{
target.Unloaded -= KeepExpandedTarget_Unloaded;
ApplyKeepExpanded(target, Orientation.Vertical, keepExpanded: false);
ApplyKeepExpanded(target, Orientation.Horizontal, keepExpanded: false);
}
}

private static void ApplyKeepExpanded(FrameworkElement target)
{
if (GetKeepVerticalExpanded(target) is bool keepVerticalExpanded)
Expand Down

0 comments on commit 16062ac

Please sign in to comment.