NativeMenu
The NativeMenu
can display a menu on macOS and some Linux distributions.
warning
This control can only be used attached to a tray icon. For full details about the tray icon, see the reference here.
You can create sub-menus by nesting <MenuItem>
elements.
You can add menu separator lines by including a <NativeMenuItemSeparator>
element or by adding a menu item with its header set to the minus sign, like this:
<NativeMenuItemSeparator Header="-" />
Useful Properties
You will probably use these properties most often:
Property | Description |
---|---|
Header | The menu caption. |
Command | A command to execute when the user clicks the menu item. |
Example
This example defines a native menu that can be attached to a tray icon:
<NativeMenu>
<NativeMenuItem Header="Settings">
<NativeMenu>
<NativeMenuItem Header="Option 1" />
<NativeMenuItem Header="Option 2" />
<NativeMenuItemSeparator />
<NativeMenuItem Header="Option 3" />
</NativeMenu>
</NativeMenuItem>
</NativeMenu>
More Information
info
For the complete API documentation about this control, see here.
info
View the source code on GitHub NativeMenu.cs