-1

I want to make a task tray application to control the a micro controller and i have made the application but i want it to be directly accessible from the task tray itself instead of the application opening.

Like this enter image description here

Mark
  • 3,273
  • 2
  • 36
  • 54
  • Possible duplicate of [WPF Application that only has a tray icon](http://stackoverflow.com/questions/1472633/wpf-application-that-only-has-a-tray-icon) – Mark Aug 04 '16 at 06:05

1 Answers1

0

Try this:

public partial class Window1 : System.Windows.Window
{

    public Window1()
    {
        InitializeComponent();

        System.Windows.Forms.NotifyIcon ni = new System.Windows.Forms.NotifyIcon();
        ni.Icon = new System.Drawing.Icon("Main.ico");
        ni.Visible = true;
        ni.DoubleClick += 
            delegate(object sender, EventArgs args)
            {
                this.Show();
                this.WindowState = WindowState.Normal;
            };
    }

    protected override void OnStateChanged(EventArgs e)
    {
        if (WindowState == WindowState.Minimized)
            this.Hide();

        base.OnStateChanged(e);
    }

More info here: Link

Hasan Alizada
  • 591
  • 4
  • 13