Home > Components > DXCore Components – Action

DXCore Components – Action

September 17th, 2010

The Action component is one of the primary, simplest and useful components of the DXCore. It registers an “action” within DXCore/CodeRush and the Visual Studio IDE, which can be triggered using either a keyboard shortcut or a mouse button (with the shift key if necessary), and/or placed within a Visual Studio menu (e.g. in the IDE main menu, Code Editor context menu, etc).

You can drop it onto your plug-in design surface from the “DXCore” category of Visual Studio Toolbox:

DXCore Action Toolbox item

It’s not a visual control, all you need is to tweak its properties and subscribe to its events. Here’s the Properties window, containing available properties, their categories and default values:

DXCore Action properties

and the Events list:

DXCore Action events

The Action component is located in the “DevExpress.CodeRush.Core” assembly. It is derived from the “System.ComponentModel.Component” class:

DXCore Action hierarchy

Here’s a list of properties in alphabetical order, without base class (Component) standard properties:

Property name Description
ActionName The name of the action displayed in the IDE Tools UI.
ButtonText Text for buttons and menu items associated with this action.
CommonMenu Visual Studio common menu enumeration, e.g. “File”, “Edit”, “View”, etc.
Description A hint associated with this action, describing this action.
Enabled Sets the enabled state for this action in the current context. You can change this property in a BeforeQueryStatus event handler.
GroupName The name of the action group.
Image Sets the bitmap image for this action. Action images are optional, but can be useful for menu items and toolbar buttons inside the IDE.
ImageBackColor Sets the image background color for this action. It is used to determine which color is to be treated as transparent in the bitmap assigned to the Image property.
Invisible Sets the visibility for this action.
Latched Sets the latched (e.g., selected or checked) state for this action in the current context. You can change this property in a BeforeQueryStatus event handler.
Ninched Sets the indeterminate state (neither checked nor cleared) for this action in the current context. You can change this property in a BeforeQueryStatus event handler.
Parameters A collection of expected parameters for this action. Optional.
ParentMenu Sets the name of the parenting command bar. If you want to create a menu item for this action, specify the name of the parenting command bar here (e.g., “Tools”). ParentMenu is an alternative to CommonMenu. Use the name of any menu you know of, to place the action on it, rather than one of “common” ones.
Position Sets the position for this action in the specified ParentMenu. The first position is one. If you specify zero for this value, the item will be appended to the end of the menu. If you specify a negative number, the menu item position will be calculated from the end of the menu (e.g., if Position equals -1, then this menu item will be inserted before the last entry).
RegisterInCR Registers this action with DXCore. If false, this action may still be available in the Visual Studio Options dialog on the Keyboard page. If you want to place this action in a menu or on a command bar, then you must set this property to true. If true, you can bind a keystroke to this command in the IDE Tools Options dialog on the Shortcuts options page.
RegisterInVS Registers this action as a Visual Studio command. If false, you can still bind a keystroke to this action in the IDE tools Options dialog on the Shortcuts page. If true, this action will be available in the Visual Studio Options dialog on the Keyboard page. If you want to place this action in a menu or on a command bar, then you must set this property to true.
RegisterMenuButton Registers this menu button for a Visual Studio command. It works only if option RegisterInVS is set to true.
Supported Indicates if this action is supported in the current context. You can change this property in a BeforeQueryStatus event handler.
ToolbarItem An instance of the “DevExpress.CodeRush.Core.ToolbarAction” object that allows you to add this action to the DXCore Visualize toolbar. The ToolbarAction object has the following properties: “BeginGroup”, “ButtonIsPressed”, “Caption”, “Image”, “Index”, “PlaceIntoToolbar”.
UserFeatureUI Show Feature UI before executing this action.
VisibleToUsers If true, this Action will be visible to users, and will appear in the command list on the Shortcuts options page, and will also be documented in the User Guide. Setting this property to false will prevent this Action from appearing in the command list. However, bindings to this Action can still be established by typing in the Action name.

Events:

Event name Description
BeforeQueryStatus Occurs when the IDE requests the status of the action.
CheckAvailability Checks the availability of this action in the current context.
Execute Occurs when this action is executed. Fired whenever the assigned shortcut is triggered or the representative menu item is chosen.
PositionMenuButton Occurs when the menu button for this action is being positioned within its parent menu or toolbar. Handling this, allows precise positioning of the menu button.
QueryStatus Occurs before an action is accessed (displayed).  This enables properties of this action to be set in the event handler before it reaches the user.
ShowHelp Occurs before this action is being executed to notify the user about the action.

See the “How to use Action DXCore control” topic for learn more.

—–
Products: DXCore
Versions: 11.1 and up
VS IDEs: any
Updated: Aug/30/2011
ID: D009

Similar Posts: