Display a notification icon in the system tray. : Forms « Windows Presentation Foundation « C# / CSharp Tutorial






<Window x:Class="NotificationIconSample.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="NotificationIconSample" Height="300" Width="300">
    <Grid>
      <Button Click="click">Click</Button>
    </Grid>
</Window>

//File:Window.xaml.cs
namespace NotificationIconSample
{
    using System;
    using System.Windows;
    using System.Windows.Forms; 
    using System.Drawing;
    public partial class MainWindow : Window
    {
        NotifyIcon notifyIcon;

        public MainWindow()
        {
            InitializeComponent();
        }

        void click(object sender, RoutedEventArgs e)
        {
            this.notifyIcon = new NotifyIcon();
            this.notifyIcon.BalloonTipText = "Hello, NotifyIcon!";
            this.notifyIcon.Text = "Hello, NotifyIcon!";
            this.notifyIcon.Icon = new System.Drawing.Icon("NotifyIcon.ico");
            this.notifyIcon.Visible = true;
            this.notifyIcon.ShowBalloonTip(1000);
        }
    }
}
WPF Display A Notification Icon In The System Tray








24.74.Forms
24.74.1.Display a notification icon in the system tray.Display a notification icon in the system tray.
24.74.2.Add the PropertyGrid to the host, and the host to the WPF GridAdd the PropertyGrid to the host, and the host to the WPF Grid
24.74.3.Use the IsSharedSizeScope attached property of the Grid elementUse the IsSharedSizeScope attached property of the Grid element
24.74.4.Control the Size of UI Elements in a FormControl the Size of UI Elements in a Form
24.74.5.Define the Tab Order of UI Elements in a FormDefine the Tab Order of UI Elements in a Form