Skip to content

Commit

Permalink
Fix: Fixed issue where details layout headers weren't always "sticky" (
Browse files Browse the repository at this point in the history
  • Loading branch information
hishitetsu authored Dec 19, 2023
1 parent 4c46fc0 commit 3d6715a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Files.App/Data/Behaviors/StickyHeaderBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ public class StickyHeaderBehavior : BehaviorBase<FrameworkElement>

private InsetClip? _contentClip;

private readonly DispatcherTimer _assignAnimationTimer;

public StickyHeaderBehavior()
{
_assignAnimationTimer = new();
_assignAnimationTimer.Interval = TimeSpan.FromMilliseconds(200);
_assignAnimationTimer.Tick += (sender, e) =>
{
AssignAnimation();
_assignAnimationTimer.Stop();
};
}

/// <summary>
/// The UIElement that will be faded.
/// </summary>
Expand Down Expand Up @@ -92,7 +105,9 @@ protected override bool Uninitialize()
private static void PropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var b = d as StickyHeaderBehavior;
b?.AssignAnimation();

// For some reason, the assignment needs to be delayed. (#14237)
b?._assignAnimationTimer.Start();
}

/// <summary>
Expand Down

0 comments on commit 3d6715a

Please sign in to comment.