MenuFactory Class
An implementation of IMenuFactory for creating default Avalonia menu controls.
public class MenuFactory : IMenuFactory
- Inheritance:
- object object
- Derived:
- BarsMenuFactory
- Implements:
- IMenuFactory
Constructors
MenuFactory()
Initializes an instance of the class.
public MenuFactory()
Properties
Current
The current factory for creating menu objects.
public static IMenuFactory Current { get; set; }
Property Value
Remarks
The default value is an instance of this class.
Methods
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 tempalte for the icon. |
Returns
- Control:
The icon control, or
nullif a control was not created.
CreateMenuFlyout(MenuFactoryCreateMenuFlyoutOptions?)
Creates a menu flyout.
public virtual MenuFlyout CreateMenuFlyout(MenuFactoryCreateMenuFlyoutOptions? options)
| Parameter | Type | Description |
|---|---|---|
| options | MenuFactoryCreateMenuFlyoutOptions | The options for the new menu flyout. When |
Returns
- MenuFlyout
CreateMenuFlyoutCore()
Creates a default new instance of the menu flyout to be configured by the factory.
protected virtual MenuFlyout CreateMenuFlyoutCore()
Returns
- MenuFlyout
CreateMenuItem(MenuFactoryCreateMenuItemOptions?)
Creates a new menu item.
public virtual MenuItem CreateMenuItem(MenuFactoryCreateMenuItemOptions? options)
| Parameter | Type | Description |
|---|---|---|
| options | MenuFactoryCreateMenuItemOptions | The options for the new menu item. When |
Returns
- MenuItem
CreateMenuSeparator()
Creates a separator.
public virtual Separator CreateMenuSeparator()
Returns
- Separator
ResolveHeaderText(string?, bool)
Resolves the header text for a menu.
protected virtual string? ResolveHeaderText(string? text, bool allowAccessKey = true)
| Parameter | Type | Description |
|---|---|---|
| text | string | The desired header text. |
| allowAccessKey | bool |
|
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?
Inherited Members
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()