### Windowless Application Setup with ResourceDictionary Source: https://context7.com/hardcodet/wpf-notifyicon/llms.txt For tray-only applications, declare the TaskbarIcon in a ResourceDictionary and load it in App.xaml. This example shows how to merge the resource dictionary and define the TaskbarIcon with a context menu and commands. ```xml ``` ```xml ``` -------------------------------- ### App.xaml.cs for Windowless Application Source: https://context7.com/hardcodet/wpf-notifyicon/llms.txt In the App.xaml.cs file for a windowless application, find the TaskbarIcon resource on startup and dispose of it on application exit. ```csharp public partial class App : Application { private TaskbarIcon _notifyIcon; protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); _notifyIcon = (TaskbarIcon)FindResource("NotifyIcon"); } protected override void OnExit(ExitEventArgs e) { _notifyIcon.Dispose(); base.OnExit(e); } } ``` -------------------------------- ### Manage WPF NotifyIcon Visibility and State Source: https://context7.com/hardcodet/wpf-notifyicon/llms.txt Use `Visibility.Collapsed` to hide the tray icon and `Visibility.Visible` to show it. Check `IsTaskbarIconCreated` for its active state and `SupportsCustomToolTips` for platform capabilities. Always call `Dispose()` to clean up resources. ```csharp // Hide the tray icon (removes it from the taskbar notification area) MyNotifyIcon.Visibility = Visibility.Collapsed; // Show it again MyNotifyIcon.Visibility = Visibility.Visible; // Check state if (MyNotifyIcon.IsTaskbarIconCreated) Console.WriteLine("Icon is active in the tray"); if (MyNotifyIcon.SupportsCustomToolTips) Console.WriteLine("Running on Vista+, custom tooltips are supported"); // Clean up — automatically called on Application.Exit, but explicit is cleaner MyNotifyIcon.Dispose(); // After disposal Console.WriteLine(MyNotifyIcon.IsDisposed); // true ``` -------------------------------- ### Setting IconSource and IconFrameworkElementSource Source: https://context7.com/hardcodet/wpf-notifyicon/llms.txt Configure the tray icon using IconSource for standard image sources or IconFrameworkElementSource for dynamic WPF elements. Mutually exclusive properties. ```xml ``` ```xml ``` ```xml ``` -------------------------------- ### Custom WPF Tooltip with TrayToolTip Source: https://context7.com/hardcodet/wpf-notifyicon/llms.txt Utilize TrayToolTip to display a rich, styled WPF UIElement as a tooltip. Fallback to ToolTipText for older systems. ```xml ``` -------------------------------- ### Interactive Popup with TrayPopup Source: https://context7.com/hardcodet/wpf-notifyicon/llms.txt Configure TrayPopup to show an interactive UIElement near the tray icon on mouse click. Control activation and placement. ```xml