Skip to content

Instantly share code, notes, and snippets.

Created June 25, 2023 17:58
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
<Application x:Class="WpfTrayIcon.App"
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Windows;
using NotifyIcon = System.Windows.Forms.NotifyIcon;
namespace WpfTrayIcon
public partial class App : Application
public static NotifyIcon icon;
protected override void OnStartup(StartupEventArgs e)
App.icon = new NotifyIcon();
icon.Click += new EventHandler(icon_Click);
icon.Icon = new System.Drawing.Icon(typeof(App), "TrayIcon.ico");
icon.Visible = true;
private void icon_Click(Object sender, EventArgs e)
MessageBox.Show("Thanks for clicking me");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment