开发者

UserControl always on top (topmost, XAML/WPF)

I'm using the WPF NotifyIcon from Philipp Sumi. It has the ability to use a WPF UserControl as popup in your tray icon. It works very nice, but in one situation I have another popup from another application that is shown on top of my popup. I want my popup to be always on top.

Can that be done? So can influence the z-order of a UserControl?

Edit - reaction to comments: I realize my question looks stupid, because the other app finds his information just as important, and thinks he should be on top. In 开发者_开发问答my case, that's not the situation. I'm connecting to an external app. The purpose of that app is to load data from an external device. When that app finished, it says "loading finished" in a popup. Then my app process the data. When my app completes the processing (almost immediately), it shows a box: "Completed processing, click here to show the data". So: in my specific case the information from my popup is more useful to the user, because it contains a button he has to click. Both popups "talk" about the same data. I understand this may raise more comment's like: "Why use a popup?". Please focus on an answer to the question, not alternative solutions.


well, there is no such MakeMyThingSuperTopMost() thinggy, you should read here why.


You can try to make the other popup "not topmost" and then show your popup. You will have to find the other popup either via enumerating all open windows with the EnumWindows api func and then remove its topmost status with SetWindowsPos. But this is definitely a dirty and fragile trick (if you can make it work at all).

http://pinvoke.net/default.aspx/user32.EnumWindows http://pinvoke.net/default.aspx/user32/SetWindowPos.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜