Skip to content

Commit 16ff1f3

Browse files
committed
Fix bouncing window with rapid appbar messages
1 parent 7306747 commit 16ff1f3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ManagedShell.AppBar/AppBarWindow.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public double DpiScale
5353

5454
// AppBar properties
5555
private int AppBarMessageId = -1;
56+
private NativeMethods.Rect _lastAppBarRect;
5657

5758
private AppBarEdge _appBarEdge;
5859
public AppBarEdge AppBarEdge
@@ -667,13 +668,14 @@ protected void UnregisterAppBar()
667668
#region Virtual methods
668669
public virtual void AfterAppBarPos(bool isSameCoords, NativeMethods.Rect rect)
669670
{
671+
_lastAppBarRect = rect;
670672
if (!isSameCoords)
671673
{
672674
var timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(0.1) };
673675
timer.Tick += (sender1, args) =>
674676
{
675677
// set position again, since WPF may have overridden the original change from AppBarHelper
676-
SetAppBarPosition(rect);
678+
SetAppBarPosition(_lastAppBarRect);
677679

678680
timer.Stop();
679681
};

0 commit comments

Comments
 (0)