MenuFactory Class
An implementation of IMenuFactory for creating menu controls.
public static class MenuFactory
- Inheritance:
- object object
Properties
Current
The current factory for creating menu objects.
public static IMenuFactory Current { get; set; }
Property Value
Remarks
The default value is a menu factory based on default menu controls supported by the platform.
Methods
TryUnwrapMenu(IMenu, out ContextMenuStrip?)
Tries to unwrap a menu that was previously wrapped.
public static bool TryUnwrapMenu(IMenu wrapped, out ContextMenuStrip? source)
| Parameter | Type | Description |
|---|---|---|
| wrapped | IMenu | The previously wrapped menu. |
| source | ContextMenuStrip | When successful, outputs the unwrapped menu. |
Returns
- bool:
trueif the menu was successfully unwrapped; otherwise,false.
See Also
TryUnwrapMenuItem(IMenuItem, out ToolStripMenuItem?)
Tries to unwrap a menu item that was previously wrapped.
public static bool TryUnwrapMenuItem(IMenuItem wrapped, out ToolStripMenuItem? source)
| Parameter | Type | Description |
|---|---|---|
| wrapped | IMenuItem | The previously wrapped menu item. |
| source | ToolStripMenuItem | When successful, outputs the unwrapped menu item. |
Returns
- bool:
trueif the menu item was successfully unwrapped; otherwise,false.
See Also
TryUnwrapMenuSeparator(IMenuSeparator, out ToolStripSeparator?)
Tries to unwrap a menu separator that was previously wrapped.
public static bool TryUnwrapMenuSeparator(IMenuSeparator wrapped, out ToolStripSeparator? source)
| Parameter | Type | Description |
|---|---|---|
| wrapped | IMenuSeparator | The previously wrapped menu separator. |
| source | ToolStripSeparator | When successful, outputs the unwrapped menu separator. |
Returns
- bool:
trueif the menu separator was successfully unwrapped; otherwise,false.
See Also
WrapMenu(ContextMenuStrip)
Wraps the given menu in an interface supported by the menu factory.
public static IMenu WrapMenu(ContextMenuStrip source)
| Parameter | Type | Description |
|---|---|---|
| source | ContextMenuStrip | The menu to wrap. |
Returns
See Also
WrapMenuItem(ToolStripMenuItem)
Wraps the given menu item in an interface supported by the menu factory.
public static IMenuItem WrapMenuItem(ToolStripMenuItem source)
| Parameter | Type | Description |
|---|---|---|
| source | ToolStripMenuItem | The menu item to wrap. |
Returns
See Also
WrapMenuSeparator(ToolStripSeparator)
Wraps the given menu separator in an interface supported by the menu factory.
public static IMenuSeparator WrapMenuSeparator(ToolStripSeparator source)
| Parameter | Type | Description |
|---|---|---|
| source | ToolStripSeparator | The menu separator to wrap. |
Returns
See Also
Fields
Default
The default factory for creating menu objects.
public static readonly IMenuFactory Default