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 : MenuFlyout, new() where TMenuItem : MenuItem, new() where TSeparator : Separator, new()
- Type Parameters:
-
TMenu-TMenuItem-TSeparator-
- Inheritance:
- object object
- Derived:
- BarsMenuFactory
- Implements:
- IMenuFactory
Constructors
MenuFactory()
Initializes an instance of the class.
public 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
CanResolveIconsThroughImageProvider
Indicates if icons can be resolved through ImageProvider when an explicit
icon is not provided for a menu item. When true, the Key
will used as the key passed to GetImageSource(string).
public bool CanResolveIconsThroughImageProvider { get; set; }
Property Value
See Also
ImageProvider
Optionally defines an explicit provider that can be used to resolve images.
When null, Default will be used.
public ImageProvider? ImageProvider { get; set; }
Property Value
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. |
CreateIconControl(object?, IDataTemplate?)
Creates the control used to display an icon.
protected virtual Control? CreateIconControl(object? icon, IDataTemplate? iconTemplate)
| Parameter | Type | Description |
|---|---|---|
| icon | object | The value which defines the icon. |
| iconTemplate | IDataTemplate | The data template for the icon. |
Returns
- Control:
The icon control, or
nullif a control was not created.
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 object? ResolveIcon(MenuFactoryMenuItemOptions options)
| Parameter | Type | Description |
|---|---|---|
| options | MenuFactoryMenuItemOptions |
Returns
ResolveMenuOverlayDismissEventPassThrough(bool?, object?)
Resolves the value to be used for overlay overlay dismiss event pass-through.
protected virtual bool? ResolveMenuOverlayDismissEventPassThrough(bool? explicitOption, object? owner)
| Parameter | Type | Description |
|---|---|---|
| explicitOption | bool? | The explicit value, if any, provided through options. |
| owner | object | The owner, of any, associated with the menu. |
Returns
- bool?
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()