Table of Contents

Class NotifyIconExtensionMethods

Namespace
System.Windows.Forms
Assembly
NetEx.Legacy.WinForms.dll

Provides extension methods for the NotifyIcon class.

public static class NotifyIconExtensionMethods
Inheritance
NotifyIconExtensionMethods
Inherited Members

Methods

ShowContextMenu(NotifyIcon, ContextMenu)

Shows the context menu for the tray icon.

public static void ShowContextMenu(this NotifyIcon notifyIcon, ContextMenu contextMenu)

Parameters

notifyIcon NotifyIcon

The NotifyIcon to show a context menu for.

contextMenu ContextMenu

The context menu to show.

Remarks

In .Net Framework, and .Net Core 3.0 and earlier, this method was available on the NotifyIcon class, along with a ContextMenu property that could be used to set the context menu for a notification icon. However, when these controls were removed in .Net Core 3.1, the ContextMenu property was removed, and the ShowContextMenu method was updated to only support ContextMenuStrip.

Rather than implement a "legacy" version of NotifyIcon under a new name, most of the old functionality can be restored through this extension method. Previously the context menu would be shown when the user right-clicks an icon in the notification area of the taskbar. However this method will need to be manually invoked when the notification icon is clicked.