From 25f1b969e46521c89df169ae58901ce5fb67f18c Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Wed, 20 Jan 2021 14:03:16 +0100 Subject: [PATCH] Apply delay when closing submenu due to pointer leave. Fixes #4729 Fixes #5320 --- .../Platform/DefaultMenuInteractionHandler.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs b/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs index 5cbd3698b6..e3e9e84d7e 100644 --- a/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs +++ b/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs @@ -355,7 +355,13 @@ namespace Avalonia.Controls.Platform } else if (!item.IsPointerOverSubMenu) { - item.IsSubMenuOpen = false; + DelayRun(() => + { + if (!item.IsPointerOverSubMenu) + { + item.IsSubMenuOpen = false; + } + }, MenuShowDelay); } } }