Description
I am trying to have a left click on the NotifyIcon
behave like the right click does (I want it to show the context menu but do it in a way where it disappears when you click elsewhere like on the Desktop). Setting the IsOpen
on that ContextMenu opens it, but it never disappears in that case (I tried using LostFocus but that doesn't work if you click say, the desktop). In searching through the source code I saw how the right click worked, but didn't have access to the underlying plumbing to make what I wanted to happen work.
I used this witchcraft to reflect on the non public members but it seems like I'll shoot myself in the foot with this approach (which I'm not beyond doing).
FieldInfo? fi = NotifyIcon.GetType().GetField("_notifyIconService", BindingFlags.NonPublic | BindingFlags.Instance);
object? notifyIconService = fi?.GetValue(NotifyIcon);
MethodInfo? openMenu = notifyIconService?.GetType().GetMethod("OpenMenu", BindingFlags.NonPublic | BindingFlags.Instance);
openMenu?.Invoke(notifyIconService, null);
My question is, can some of these private members be surfaced in a way that allows the caller some more options to tweak.
P.S. Your library is absolutely amazing. I love it. Much respect.