Does ShowDialog make an application window disappear from the Alt-Tab window list?

I am new to WPF and I am trying to open a modal dialog from my main window:

public partial class MainWindow : Window { protected void OpenCommandExecuted(object target, ExecutedRoutedEventArgs e) { DataSearchWindow w = new DataSearchWindow(); w.Owner = this; w.ShowDialog(); } ... } 

and the XAML for my DataSearchWindow is as follows:

 <Window x:Class="DataSearchWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ShowInTaskbar='False' WindowStartupLocation='CenterOwner' WindowStyle='ToolWindow' ...> ... </Window> 

Everything works until I press Alt-Tab to switch to another application. When I do this, my application disappears from the list displayed when Alt-Tab is pressed. It is still in the taskbar, and I can return to it with the mouse, and not with Alt-Tab. Has anyone seen this?

Konstantin

+4
source share
1 answer

This is because of the modal dialog - you cannot Alt-Tab return to the application until the dialog is closed. Since WindowStyle is set as ToolWindow, it will not be displayed in the Alt-Tab. However, if it was a regular window, the dialog box will appear in the Alt-Tab.

Please note that this is not a WPF problem - it is compatible, for example, with a Windows Forms application.

+8
source

All Articles