fixed a bug of NotifyIcon

This commit is contained in:
NaBian committed 2019-12-01 21:12:51 +08:00
1 parent 3e98a60246
commit 309f4a72e6
1 file changed
+16
@@ -636,6 +636,22 @@ namespace HandyControl.Controls
}
else if (ContextMenu != null)
{
if (ContextMenu.Items.Count == 0) return;
ContextMenu.InvalidateProperty(StyleProperty);
foreach (var item in ContextMenu.Items)
{
if (item is MenuItem menuItem)
{
menuItem.InvalidateProperty(StyleProperty);
}
else
{
var container = ContextMenu.ItemContainerGenerator.ContainerFromItem(item) as MenuItem;
container?.InvalidateProperty(StyleProperty);
}
}
ContextMenu.Placement = PlacementMode.Mouse;
ContextMenu.IsOpen = true;