How to show a RadNotifyIcon without opening any WPF windows
Environment
Product | RadNotifyIcon for WPF |
Description
Display the RadNotifyIcon without opening a WPF Window.
Solution
Instantiate the RadNotifyIcon in code and invoke its AddIcon method.
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
var uri = new Uri("/YourProjectName;component/YourIconName.ico", UriKind.RelativeOrAbsolute);
StreamResourceInfo streamInfo = Application.GetResourceStream(uri);
var iconImage = new System.Drawing.Icon(streamInfo.Stream);
var icon = new RadNotifyIcon() { TrayIcon = iconImage, GuidItem = new Guid("12345678-9123-4567-8901-234567890123") };
icon.AddIcon();
}