I have a simple app which is small and is supposed to float on top of all my other windows. After a few hours, I'll notice it is no longer on top of all my other windows and I was wondering if anyone knew why this happens.
During this time I have opened new applications (mostly MS 2010 products), locked/unlocked my PC a few times, hit the Desktop shortcut, and moved the app around on the screen (sometimes between screens since I have two monitors).
I have not been able to duplicate the behavior on demand, however it happens at least once a day. When it stops staying on top, it hides itself when I hit the desktop shortcut, so I think somehow the TopMost
property is getting set to false.
<Window AllowsTransparency="True"
WindowStyle="None"
Topmost="True"
SizeToContent="WidthAndHeight"
MouseDown="Window_MouseDown"
ShowInTaskbar="False"
Background="Transparent"
SnapsToDevicePixels="True">
The app is really simple... it just works like a virtual chess clock and lets me track time spent handling help desk calls vs actual development. The MouseDown event simply triggers the drag/drop behavior of the application since WindowStyle is set to None.
I am running WindowsXP and the app was built in .Net 4.0.
Perhaps you could capture the Deactivated event, and force the Window back ontop again?
Just a guess really, but it'd be worth investigating if setting
Topmost = False
thenTopmost = True
at the right time fixes it.