I am trying to make a WPF app (regular Windows app, not XBAP or Silverlight). I want the main app window to support transparency, and show through the desktop below.
But when I specify ToolTip text on a Button, the ToolTip appears beneath (z-order) the main window!
I have a screenshot where: * Another app overlapps and blocks view of the partially transparent main window. * The tooltip from my button appears in front of the other app. * Where the tooltip is not in front of the other app, it is behind the partial transparency.
I read elsewhere that this is a known problem with the WPF engine for 32-bit XP and does not occur in Vista.
What I am looking for is a fix/workaround.
Ok- here's what I found as a workaround:
The problem with ToolTips goes away when the window is also made TopMost.
But I don't want my window to be topmost, so I only do it when my window has keyboard focus:
private void Window_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
this.Topmost = true;
}
private void Window_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
this.Topmost = false;
}
Then I use a binding to enable each ToolTip only when my window is Topmost:
ToolTipService="{Binding ElementName=MainWindow, Path=Topmost}"
This turns off the ToolTip except when it works right. Don't really need tooltips when my window isn't in focus anyway.
Only annoying thing now is that the on/off binding has to be done on every element that defines a Tooltip.