Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Completely hide WPF window on startup?

Tags:

.net

window

wpf

I want that my window is completely hidden on the startup. No window, no entry in the taskbar. The user doesn't see, the application is started.

How can I realize that?

Thank you!

like image 822
rakete Avatar asked Jul 14 '11 09:07

rakete


2 Answers

An alternative to H.B.'s method is just to set the Visibility to hidden and set ShowInTaskbar to false. This still creates the window and lets it do its thing.

<Window x:Class="WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" ShowInTaskbar="False" Visibility="Hidden">
    <Grid>

    </Grid>
</Window>
like image 156
LukeN Avatar answered Oct 14 '22 12:10

LukeN


Don't show the window. By default there is a StartupUri defined in the App.xaml, remove it and override the OnStartup method in the code-behind to create a window, just Show and Hide it as you wish.

like image 44
H.B. Avatar answered Oct 14 '22 13:10

H.B.