
activate either popup or message sink to track deactivation. If (handle = IntPtr.Zero) handle = messageSink.MessageWindowHandle if we don't have a handle for the popup, fall back to the message sink If (source != null) handle = source.Handle HwndSource source = (HwndSource)PresentationSource.FromVisual(TrayPopupResolved.Child) try to get a handle on the popup itself (via its child) And this worked! Here's the updated snippet (currently with a fallback mechanism and probably redundant null checks): I couldn't get a handle of the popup itself, but of the popup's content. What I tried now is setting the foreground to the popup's window handle itself. WinApi.SetForegroundWindow(messageSink.MessageWindowHandle)
#Wpf popup window windows#
does not close if the user clicks somewhere else With the SMP Agentry WPF client v7.0.3.605, when you have 2 active windows and a pop up is activated, the pop up is behind the main window Example: A. activate the message window to track deactivation - otherwise, the popup This was required in order to have the Popup close if the user clicked on the desktop or another application: Actually, I already used Interop to set the foreground to the NotifyIcon's own message sink. Thanks you so much for the hint - I think I have (or am close to) a working solution :)
#Wpf popup window how to#
I currently don't really have an idea how to tackle this issue without introducing major hacks (read: dummy windows) into the control, so I'd be glad for any ideas that could get me back on track :) Hi,Popup and ToolTip are layered window, so they are always displayed at top most. But as there is no visible window (actually no regular WPF window at all), certain controls are being "disabled", while others work. A Popup that covers more than 75 percent of the screen, reduces its width first and then its height to meet the maximum coverage limit of 75 percent. The background of this issue: My NotifyIcon supports interactive popups that can be displayed if the NotifyIcon in the Tray is clicked. A Popup whose width is greater than the screen width, repositions itself along the left edge of the screen.

In case you'd like to have a look at it yourself, I've created a simple project: I succeeded to reproduce the issue in a WPF application, by setting the main window to invisible. However, if you paste that Popup in a Window in Visual Studio, everything works ok - at first.

Unfortunately, it's not Kaxaml that's causing me headaches :) So something in Kaxaml doesn't quite work as one might expect. you will notice that the Button behaves like a regular button (you can click it), while the TextBox does not take focus: You can neither select nor edit the text. Just paste the following snipped into Kaxaml and try to select the TextBox control of the popup: I'm struggling with an issue that is related to my NotifyIcon control, and was hoping one of you could point me in the right direction.įirst, in case you have KaXaml installed, you can look at the issue very easily.
