Do Not Show a WPF Window Taskbar Button

By Michael Detras

By default, when a WPF window is shown, its corresponding taskbar button is also shown. This might not be ideal when you use many windows as dialogs in a single application.

If you do not want to show the task bar button for a window, just set the Window's ShowInTaskbar property to false before showing it.

private void Button_Click(object sender, RoutedEventArgs e)
{
    var window = new Window1();
    window.ShowInTaskbar = false;
    window.Show();
}

You can also do it in XAML.

<Window x:Class="WpfApplication1.Window1"
         
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         
Title="Window1" Height="300" Width="300"
        
ShowInTaskbar="False">
    <Grid>
        
     </Grid>
</Window>

Do Not Show a WPF Window Taskbar Button  (4348 Views)