2
votes

I have two windows (WPF), the MainWindow and Window1, from MainWindow user can show the Window1 as Modal Window:

private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
    var win = new Window1();
    win.Owner = this;
    win.WindowStyle = WindowStyle.ToolWindow;
    win.ShowInTaskbar = false;

    win.ShowDialog();
}

So I hope the Window1 doesn't show in taskbar, but this application can be seen in ALT + TAB, any simple way to achieve this?

And from the research, it seems if application task can not be seen in ALT + TAB unless setting ShowInTaskbar = true, but I also don't want the Window1 show in task bar.

When I check Visual Studio, click Help/About the modal dialog shows, and it didn't show in taskbar, but also the Visual Studio main window can be seen in ALT + TAB, that's what I would like to achieve.

2

2 Answers

2
votes

Problem is in your WindowStyle. ToolWindow skip Alt+Tab Just remove this line

win.WindowStyle = WindowStyle.ToolWindow;

or replace other style

If you want to use Window1 like tool. You just use win.Show()

2
votes

Try to create a new XAML Window and put ShowInTaskbar="False" on your XAML code of your New Window.