WPF Window appear in the lower left foot

duwen 21 Reputation points

WPF After I set ShowInTaskBar=false for the window, when I hit minimize, I don't want the window to appear in the lower left foot, what do I do

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,192 questions
No comments
{count} votes

Accepted answer
  1. DaisyTian-1203 11,506 Reputation points

    You can use System.Windows.Forms to use NotifyIcon and System.Drawing to use Icon to implement the hidden of minimized window under the taskbar on the right. It looks like below picture shown:

    To implement it, you need to add the below code to your cs code:

    public partial class MainWindow : Window  
            NotifyIcon notifyIcon;  
            public MainWindow()  
            private void Window_StateChanged(object sender, EventArgs e)  
                switch (this.WindowState)  
                    case WindowState.Maximized:  
                    case WindowState.Minimized:  
                        this.notifyIcon = new NotifyIcon();  
                        notifyIcon.BalloonTipText = "This is WPF app";  
                        notifyIcon.Icon = new System.Drawing.Icon("Todolist.ico");  
                        notifyIcon.Visible = true;  
                        notifyIcon.MouseDoubleClick += OnNotifyIconDoubleClick;  
                    case WindowState.Normal:  
            private void OnNotifyIconDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e)  
                WindowState = WindowState.Normal;  

1 additional answer

Sort by: Most helpful
  1. Viorel 83,101 Reputation points

    If this is a secondary window and you want to hide it, then handle the StateChanged event:

    private void Window_StateChanged( object sender, EventArgs e )
        if( WindowState == WindowState.Minimized)
            Hide( );

    You should have a mechanism to re-show it, and to close when the application exits.