In This Article

BarsMenuFactory Class

An implementation of IMenuFactory for creating menus using Bars controls.

public class BarsMenuFactory : MenuFactory<IMenu, IMenuItem, IMenuSeparator>, IMenuFactory
Inheritance:
object MenuFactory<IMenu, IMenuItem, IMenuSeparator> object
Implements:
IMenuFactory

Remarks

A menu factory is used to generate any default context menus created by several Actipro products. By assigning Current to an instance of this class, those default context menus can have the same look and feel as the primary application menus based on the Bars product.

Constructors

BarsMenuFactory(BarManager)

An implementation of IMenuFactory for creating menus using Bars controls.

public BarsMenuFactory(BarManager barManager)
Parameter Type Description
barManager BarManager

The BarManager that will be used to define the menus.

Remarks

A menu factory is used to generate any default context menus created by several Actipro products. By assigning Current to an instance of this class, those default context menus can have the same look and feel as the primary application menus based on the Bars product.

Properties

BarManager

The BarManager that will be used to define the menus.

public BarManager BarManager { get; }

Property Value

BarManager

CanCopyExistingCommandImage

Indicates if the Image of an existing command can be copied to a new command.

public bool CanCopyExistingCommandImage { get; set; }

Property Value

bool

Remarks

This property only applies when ExistingCommandStrategy is set to Copy. The default value is true.

CanCopyExistingCommandKeyboardShortcuts

Indicates if the KeyboardShortcuts of an existing command can be copied to a new command.

public bool CanCopyExistingCommandKeyboardShortcuts { get; set; }

Property Value

bool

Remarks

This property only applies when ExistingCommandStrategy is set to Copy. The default value is true.

ExistingCommandStrategy

Indicates the strategy to use when matching a requested menu item with any existing BarCommand defined on BarManager.

public BarsMenuFactoryExistingCommandStrategy ExistingCommandStrategy { get; set; }

Property Value

BarsMenuFactoryExistingCommandStrategy

Methods

When ExistingCommandStrategy is set to Copy and an existing command was matched, this method is invoked to copy relevant data from the existing command to the link that represents that command.

protected virtual void CopyExistingCommand(BarCommand existingCommand, BarCommandLink targetCommandLink)
Parameter Type Description
existingCommand BarCommand

The existing BarCommand that was matched.

targetCommandLink BarCommandLink

The new BarCommandLink that was created for a menu item.

See Also

CreateMenuCore(MenuFactoryMenuOptions)

Creates and configures a new instance of a menu.

protected override IMenu CreateMenuCore(MenuFactoryMenuOptions options)
Parameter Type Description
options MenuFactoryMenuOptions

The options for the new menu.

Returns

IMenu

Remarks

The ColorScheme option is not supported by this menu factory and all menus will use the same renderer and color scheme as BarManager.

CreateMenuItemCore(MenuFactoryMenuItemOptions)

Creates and configures a new instance of a menu item.

protected override IMenuItem CreateMenuItemCore(MenuFactoryMenuItemOptions options)
Parameter Type Description
options MenuFactoryMenuItemOptions

The options for the new menu item.

Returns

IMenuItem

CreateMenuSeparatorCore()

Creates a separator.

protected override IMenuSeparator CreateMenuSeparatorCore()

Returns

IMenuSeparator

FindExistingCommand(MenuFactoryMenuItemOptions)

Attempts to locate an existing BarCommand that matches the given options.

protected virtual BarCommand? FindExistingCommand(MenuFactoryMenuItemOptions options)
Parameter Type Description
options MenuFactoryMenuItemOptions

The options which define the menu item to be matched against a BarCommand.

Returns

BarCommand:

The matching BarCommand if found; otherwise, null.

Remarks

By default, this method performs a match against commands defined by Commands that have the same case-insensitive category and name as the requested menu item.

See Also

TryParseCommandFullName(string?, out string?, out string?)

Tries to parse the full name of a command into the category and name parts.

protected virtual bool TryParseCommandFullName(string? fullName, out string? category, out string? name)
Parameter Type Description
fullName string

The full name of the command.

category string

When successful, outputs the category name.

name string

When successful, outputs the command name.

Returns

bool:

true if the full name was successfully parsed, otherwise false.

Inherited Members

Extension Methods