mark yer
mark yer

Reputation: 403

minimize WPF application into Taskbar

I am using This WPF NotifyIcon and all works fine:

<tb:TaskbarIcon
    Name="taskbarIcon"            
    IconSource="icon.ico"
    ToolTipText="hello world">
</tb:TaskbarIcon>

But when minimize my application i can see the application open and not only the Icon in the Task Bar. How to hide the application when minimize ?

Upvotes: 1

Views: 865

Answers (1)

Mathew Sachin
Mathew Sachin

Reputation: 1449

Subscribe to the StateChangingEvent

Add this code in your Window's Constructor

StateChanged += (s, e) => if (WindowState == WindowState.Minimized) Hide();

Upvotes: 1

Related Questions