Get out of the way with the tray ["Minimize to tray" sample implementation for WPF]
**
This blog has moved to a new location and comments have been disabled.
All old posts, new posts, and comments can be found on The blog of dlaa.me.
See you there!
Comments
Anonymous
December 18, 2009
Cheers' I extended it a tad - http://www.leghumped.com/blog/2009/12/19/minimize-to-tray-with-wpf/Anonymous
December 19, 2009
Echilon, Neat stuff - thanks for sharing!Anonymous
September 30, 2010
The comment has been removedAnonymous
September 30, 2010
Simon, Thanks for the tip! :) FYI for others: This isn't an issue for Insomnia because you can only close it when the window is restored (and therefore the notify icon isn't present because it's shown only when the window is minimized).Anonymous
January 20, 2014
I would like the application to appear in the system tray at startup. I set to window to be minimized on start up but the application appeared in the task bar as usual and not in the system tryeAnonymous
January 20, 2014
In this case, you probably want to add code at startup to detect if the window's initial state is minimized and invoke the minimize-to-tray action yourself (via HandleStateChanged). Hope this helps!Anonymous
January 20, 2014
By handling the load event and setting the window state to minimized this places the application in the system tray at start upAnonymous
January 22, 2014
Hello! Great post! I have an urgent question: I have a certain button that when clicked, the form will be minimized. And if the form's minimize button (beside close button) is clicked, the form's state will be normal, I mean it will be in the task bar. in short, I just want my app to be min to tray by clicking a button and not by clicking the form's minimize button. My solution is this: the code MinimizeToTray.Enable(this); is only executing in the MIN TO TRAY button click event. at first of course my program works well, but once you click the min to tray button and then click the form's minimize button...the form will be in the tray too. I just want to disable this function after the window's state is returned to normal.Anonymous
January 22, 2014
Got it working! I added: _window.StateChanged -= new EventHandler(HandleStateChanged); below the WindowStateNormal in HandleNotifyIconOrBalloonClicked