Sometimes taskbar icon jitters and instacloses.
This happens every time every first launch. On icon right click, the context menu appears in the wrong place and instantly disappears.
Seems to have something to do with window not being focusable. Not sure how to fix it.
I've spent some time on the topic yesterday. But I could not find a solution till now. I've found some equal behaviors with message boxes insta-closing when there is no main UI thread. After insta-closing, the next message boxes are working: https://stackoverflow.com/questions/28017576/wpf-taskbaricon-contextmenu
I can reproduce it also with:
- left-click tray icon (main window is hidden)
- left-click tray icon again (main window is shown again)
- right-click tray icon (the context menu is shown shortly and insta-closes again)
- right-click tray icon again (the context menu is shown and stays) goto 1.
It "feels" like it could be related.
And you are right, if the "WS_EX_NOACTIVATE" part is disabled, the problem is gone. But then the main window is stealing the focus.