diff --git a/Business/Menus.cs b/Business/Menus.cs
index 139d49e..e3e0dce 100644
--- a/Business/Menus.cs
+++ b/Business/Menus.cs
@@ -355,8 +355,14 @@ namespace SystemTrayMenu.Business
if (menuData.DirectoryState != MenuDataDirectoryState.Undefined)
{
// Sub Menu (completed)
+ // As we need to render it during calculations but we don't want to show flickering windows,
+ // we just hide it for just a moment and show it again after updates have been applied.
+ // In order to hide it via Opacity we have to cancel any Fade animations.
+ menu.StopFade();
+ menu.Opacity = 0D;
menu.AddItemsToMenu(menuData.RowDatas, menuData.DirectoryState);
AdjustMenusSizeAndLocation(menu.Level);
+ menu.Opacity = 1D;
}
else
{
diff --git a/UserInterface/Menu.xaml b/UserInterface/Menu.xaml
index 8865e71..ec8715f 100644
--- a/UserInterface/Menu.xaml
+++ b/UserInterface/Menu.xaml
@@ -18,7 +18,7 @@
-
+
-
+
-
+
+
+
+
+
+
diff --git a/UserInterface/Menu.xaml.cs b/UserInterface/Menu.xaml.cs
index 5c7a23e..389cd04 100644
--- a/UserInterface/Menu.xaml.cs
+++ b/UserInterface/Menu.xaml.cs
@@ -37,6 +37,9 @@ namespace SystemTrayMenu.UserInterface
private static readonly RoutedEvent FadeOutEvent = EventManager.RegisterRoutedEvent(
nameof(FadeOut), RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(Menu));
+ private static readonly RoutedEvent FadeStopEvent = EventManager.RegisterRoutedEvent(
+ nameof(FadeStop), RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(Menu));
+
private readonly string folderPath;
private bool isShellContextMenuOpen;
@@ -243,6 +246,12 @@ namespace SystemTrayMenu.UserInterface
remove { RemoveHandler(FadeOutEvent, value); }
}
+ internal event RoutedEventHandler FadeStop
+ {
+ add { AddHandler(FadeStopEvent, value); }
+ remove { RemoveHandler(FadeStopEvent, value); }
+ }
+
internal enum StartLocation
{
Point,
@@ -503,6 +512,14 @@ namespace SystemTrayMenu.UserInterface
}
}
+ internal void StopFade()
+ {
+ if (Settings.Default.UseFading)
+ {
+ RaiseEvent(new(routedEvent: FadeStopEvent));
+ }
+ }
+
///
/// Update the position and size of the menu.
///