Skip to main content

Component Plug-In SDK 2026 R1

Method AddMenuItem

Last update: 19.06.2026

Namespace: Phoenix.ComponentPlugInSDK
Assembly: Phoenix.ComponentPlugInSDK.dll

AddMenuItem(ItemsControl, string, RoutedEventHandler)

Adds a child menuItem to the specified parent.

protected MenuItem AddMenuItem(ItemsControl parent, string header, RoutedEventHandler eventHandler)

Parameters

parent ItemsControl

The parent of the new menuItem.

header string

The header of the menuItem.

eventHandler RoutedEventHandler

The event handler to call when the menuItem is clicked. If this method throws an exception it will be passed to Phoenix.ComponentPlugInSDK.AbstractBuilderUI1.DisplayException(System.Exception)`

Returns

MenuItem

The MenuItem that was added.

Remarks

If you have an async event handler, use Phoenix.ComponentPlugInSDK.AbstractBuilderUI1.AddAsyncMenuItem(System.Windows.Controls.ItemsControl,System.String,Phoenix.ComponentPlugInSDK.AbstractBuilderUI{0}.RoutedEventHandlerAsync)

AddMenuItem(ItemsControl, string, ImageType, bool, RoutedEventHandler)

Adds a child menuItem to the specified parent.

protected MenuItem AddMenuItem(ItemsControl parent, string header, ImageType imageType, bool hasDownArrow = false, RoutedEventHandler eventHandler = null)

Parameters

parent ItemsControl

The parent of the new menuItem.

header string

The header of the menuItem.

imageType ImageType

The image type to display on the menuItem.

hasDownArrow bool

If a down arrow should appear on the right side of the menu item.

eventHandler RoutedEventHandler

The event handler to call when the menuItem is clicked. If this method throws an exception it will be passed to Phoenix.ComponentPlugInSDK.AbstractBuilderUI1.DisplayException(System.Exception)`

Returns

MenuItem

The MenuItem that was added.

Remarks

If you have an async event handler, use Phoenix.ComponentPlugInSDK.AbstractBuilderUI1.AddAsyncMenuItem(System.Windows.Controls.ItemsControl,System.String,Phoenix.ComponentPlugInSDK.Images.ImageType,System.Boolean,Phoenix.ComponentPlugInSDK.AbstractBuilderUI{0}.RoutedEventHandlerAsync)

AddMenuItem(ItemsControl, string, ImageSource, bool, RoutedEventHandler)

Adds a child menuItem to the specified parent.

protected MenuItem AddMenuItem(ItemsControl parent, string header, ImageSource image = null, bool hasDownArrow = false, RoutedEventHandler eventHandler = null)

Parameters

parent ItemsControl

The parent of the new menuItem.

header string

The header of the menuItem.

image ImageSource

The image to display on the menuItem.

hasDownArrow bool

If a down arrow should appear on the right side of the menu item.

eventHandler RoutedEventHandler

The event handler to call when the menuItem is clicked. If this method throws an exception it will be passed to Phoenix.ComponentPlugInSDK.AbstractBuilderUI1.DisplayException(System.Exception)`

Returns

MenuItem

The MenuItem that was added.

Remarks

If you have an async event handler, use Phoenix.ComponentPlugInSDK.AbstractBuilderUI1.AddAsyncMenuItem(System.Windows.Controls.ItemsControl,System.String,System.Windows.Media.ImageSource,System.Boolean,Phoenix.ComponentPlugInSDK.AbstractBuilderUI{0}.RoutedEventHandlerAsync)

Connect with Ansys