H.NotifyIcon icon indicating copy to clipboard operation
H.NotifyIcon copied to clipboard

[Core] Add ability to use context menus and other events related components

Open HavenDV opened this issue 2 years ago • 3 comments

What would you like to be added:

Why is this needed:

For which Platform:

  • [ ] All
  • [ ] WPF
  • [ ] WinUI
  • [ ] Uno
  • [x] Core

Anything else we need to know?

HavenDV avatar Apr 26 '22 08:04 HavenDV

At the moment, I don't know the reason why the console application does not receive events on the MessageWindow (although the platform libraries work with the same code). It is possible that this is precisely due to the lack of a full-fledged UI thread and the corresponding Win32 calls that allow the process to receive the necessary messages. I do not promise that it will be in the near future.

You can test the behavior in your particular case by subscribing to TrayIcon.MessageWindow.MouseEventReceived. If you get these events, you can use the H.NotifyIcon.PopupMenus package to create a context menu. Here is also a sample code using PopupMenu: https://github.com/HavenDV/H.NotifyIcon/blob/23cb9fb9f2139fa196966ec78ac2f6efe23efcf7/src/libs/H.NotifyIcon.Shared/TaskbarIcon.ContextMenu.cs#L214-L246

HavenDV avatar Apr 26 '22 08:04 HavenDV

Is it possible to change a context menu item property (like Text) in the runtime?🤔

ArvinZJC avatar May 04 '22 10:05 ArvinZJC

Is it possible to change a context menu item property (like Text) in the runtime?🤔

It will depend on the ContextMenu mode for WinUI. Binding is currently not available for the default mode, but should work for other modes. At the same time, changing the text at the moment between opening the ContextMenu should work for all modes.

HavenDV avatar May 04 '22 11:05 HavenDV

Added

HavenDV avatar Aug 17 '22 12:08 HavenDV