In This Article

MenuFactory<TMenu, TMenuItem, TSeparator> Class

An implementation of IMenuFactory for creating default menu controls supported by the platform.

public class MenuFactory<TMenu, TMenuItem, TSeparator> : IMenuFactory where TMenu : IMenu where TMenuItem : IMenuItem where TSeparator : IMenuSeparator
Type Parameters:
TMenu -
TMenuItem -
TSeparator -
Inheritance:
object object
Derived:
BarsMenuFactory
Implements:
IMenuFactory

Constructors

MenuFactory()

Initializes an instance of the class.

protected MenuFactory()

Properties

AllowIcons

Indicates if menu items are allowed to show icons, when available.

public bool AllowIcons { get; set; }

Property Value

bool:

true to allow icons, when available; otherwise, false to hide icons. The default value is true.

See Also

AllowInputGestures

Indicates if menu items are allowed to show input gestures (e.g., keyboard shortcuts), when available.

public bool AllowInputGestures { get; set; }

Property Value

bool:

true to allow input gestures, when available; otherwise, false to hide input gestures. The default value is true.

See Also

Methods

CoerceMenuItemOptionsFromCommand(MenuFactoryMenuItemOptions, ICommand)

Coerces unset options from a command.

protected virtual void CoerceMenuItemOptionsFromCommand(MenuFactoryMenuItemOptions options, ICommand command)
Parameter Type Description
options MenuFactoryMenuItemOptions

The options to be updated.

command ICommand

The command to examine.

CreateMenu(MenuFactoryMenuOptions?)

Creates a menu.

public TMenu CreateMenu(MenuFactoryMenuOptions? options)
Parameter Type Description
options MenuFactoryMenuOptions

The options for the new menu. When null, default options will be used.

Returns

TMenu

CreateMenuCore(MenuFactoryMenuOptions)

Creates and configures a new instance of a menu.

protected virtual TMenu CreateMenuCore(MenuFactoryMenuOptions options)
Parameter Type Description
options MenuFactoryMenuOptions

The options for the new menu.

Returns

TMenu

CreateMenuItem(MenuFactoryMenuItemOptions?)

Creates a menu item.

public TMenuItem CreateMenuItem(MenuFactoryMenuItemOptions? options)
Parameter Type Description
options MenuFactoryMenuItemOptions

The options for the new menu item. When null, default options will be used.

Returns

TMenuItem

CreateMenuItemCore(MenuFactoryMenuItemOptions)

Creates and configures a new instance of a menu item.

protected virtual TMenuItem CreateMenuItemCore(MenuFactoryMenuItemOptions options)
Parameter Type Description
options MenuFactoryMenuItemOptions

The options for the new menu item.

Returns

TMenuItem

CreateMenuSeparator()

Creates a separator.

public TSeparator CreateMenuSeparator()

Returns

TSeparator

CreateMenuSeparatorCore()

Creates and configures a new instance of a menu separator.

protected virtual TSeparator CreateMenuSeparatorCore()

Returns

TSeparator

ResolveHeaderText(string?, bool)

Resolves the header text (i.e., label) for a menu item.

protected virtual string? ResolveHeaderText(string? text, bool allowAccessKey = true)
Parameter Type Description
text string

The desired header text.

allowAccessKey bool

true to allow access characters; otherwise false to escape access characters.

Returns

string

ResolveIcon(MenuFactoryMenuItemOptions)

Resolves the icon to be used for a menu item.

protected virtual Image? ResolveIcon(MenuFactoryMenuItemOptions options)
Parameter Type Description
options MenuFactoryMenuItemOptions

Returns

Image

ToString()

Returns the string representation of this object.

public override string ToString()

Returns

string:

The string representation of this object.

Inherited Members

Extension Methods