I want my window to be on top of all other windows in my application only. If I set the TopMost property of a window, it becomes on top of all windows of al
The best way is set this two events to all of windows of your app:
GotKeyboardFocus
LostKeyboardFocus
in this way:
WiondowOfMyApp_GotKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
{
windowThatShouldBeTopMost.TopMost = true;
}
WiondowOfMyApp_LostKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
{
windowThatShouldBeTopMost.TopMost = false;
}