Is it possible to make a window stay always on top even when other application is running on Fullscreen? I'm using right now TopMost = true
but when other application is running on fullscreen mine becomes invisible. It's WindowStyle = None
window by the way.
Edit: And do not let other window minimalize ofcourse
None of the solutions above for me worked, so here is what I ended up doing. It worked perfectly for me.
Basically, to keep it on top you just set the lose focus event to make it go back to top.
XAML:
Code Behind:
Try this solution from MSDN, it should work for you. In the
Window Activated Event
add the following code:in
DeActivated Event
add the following codeOriginal post from MSDN
So I ran into the same requirement recently. It seems the top rated answer as well as the second didn't properly work for me. I've found a solution that seems to work flawlessly and somewhat adheres to best practice using MVVM.
Using the below forces the window to the top and never lapses on change like the other solutions.
Step 1: I created a simple state manager class for my main client window. I used INotifyPropertyChanged to keep property in sync when using a direct binding to my window. (very important)
Step 2.1: Added my state manager class to my ViewModel. (MVVM)
Step 2.2: Then set your window data context to your view model.
Step 3: Add your data binding to your window.
So now you can manage your window state using the state manager object initialized within the View Model. You can call SetTop() from you state manager to push it forward, or UnSetTop() to stop it. Hope this helps anyone looking to do the same.
If you want your application to stay on top of EVERYTHING (including the start interface in Windows 8, previously known as "Metro"), then you can specify UiAccess="True" in your manifest file. This is typically used by accessibility applications such as onscreen keyboards.
From memory you need to do 3 things;
This won't work 100% of the time, but it will improve the situation somewhat. You can set
Topmost = true
in the handler for theWindow.Deactivated
event:The
Deactivated
event will be called whenever your application loses focus (often when another application requests to beTopmost
) and so this will reset your application on top after this.I had a main window that I wanted to keep on top of everything (if the user checked "always on top".
This worked for me. Hope this helps someone.