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:
trueto allow icons, when available; otherwise,falseto hide icons. The default value istrue.
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:
trueto allow input gestures, when available; otherwise,falseto hide input gestures. The default value istrue.
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 |
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 |
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 |
|
Returns
ResolveIcon(MenuFactoryMenuItemOptions)
Resolves the icon to be used for a menu item.
protected virtual Image? ResolveIcon(MenuFactoryMenuItemOptions options)
| Parameter | Type | Description |
|---|---|---|
| options | MenuFactoryMenuItemOptions |
Returns
ToString()
Returns the string representation of this object.
Inherited Members
- object.GetType()
- object.MemberwiseClone()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()