DXCore Components – SmartTagProvider
The SmartTagProvider DXCore component provides a custom smart tag item used in the Visual Studio IDE context menu or in the Refactor! popup menu. Here’s a standard Refactor! popup menu – it may contain the Refactor!, Code! and other smart tag providers:
The Popup menu is configurable on the “Editor | Smart Tags Catalog” options page in the Options Dialog:
The SmartTagProvider control doesn’t exist on the Visual Studio toolbox, by default. You have to manually add it by selecting the “Choose Items” in the context menu of the Visual Studio toolbox:
and locating the SmartTagProvider in the list:
Here’s the Properties window, containing available properties, their categories and default values:
and the Events list:
The SmartTagProvider component is located in the “DevExpress.CodeRush. Core” assembly. It is derived from the “SmartTagProviderBase” base type from the same “DevExpress.CodeRush.Core” assembly:
Here’s a list of properties in alphabetical order:
Property name |
Description |
Description | Text, describing the purpose or behavior of this plug-in extension. This text may appear inside the User Guide, configuration UI, or the About box. |
DisplayName | The text name that identifies this extension. This text may appear inside the User Guide, configuration UI, or the About box. |
Image | Sets the bitmap image for this provider. Provider images are optional, but can be useful for menu items inside the IDE. |
ImageBackColor | Sets the image background color for this provider’s image. It is used to determine which color is to be treated as transparent in the bitmap assigned to the Image property. |
MenuOrder | Position of the provider in the Popup menu. |
ProviderName | The name of this provider. |
Register | If true, this extension will be available to the DXCore. Otherwise, it will be hidden. |
ShowInContextMenu | Gets or sets the value indicating if a smart tag provider should be shown in the Visual Studio editor context menu. |
ShowInPopupMenu | Gets or sets the value indicating if a smart tag provider should be shown in the Popup menu. |
Events:
Event name |
Description |
CanShowInContextMenu | Handle this event to specify whether this smart tag provider can be added to the VS editor context menu. |
CheckSmartTagAvailability | Handle this event to specify whether this smart tag provider is available. |
ContextMenuInvalidate | Occurs when the editor context menu is invalidated. This event is raised for each smart tag provider. |
ContextMenuShow | Occurs when the editor context menu with this smart tag provider is shown. |
GetSmartTagItemColors | Handle this event to initialize smart tag provider colors for the Popup menu. |
GetSmartTagItems | Handle this event to initialize smart tag provider menu items. |
ItemExecute | Occurs when the item execute event is triggered. |
LanguageSupported | Handle this optional event if you want to restrict your context to one or more programming languages. If you do not handle this event, theDXCore makes your context available in all programming languages. |
And the list of methods for using of this control:
Method Name |
Description |
ClearMenuItems | Clears the cached menu items. |
GetItem(String) | Returns the menu item by the given name. |
GetItemColors | Returns the colors used for this smart tag provider in the Popup menu. |
GetItems | Gets all menu items for this smart tag provider. Menu items are cached to improve performance, call ClearMenuItems to clear cached values and invalidate the items. |
HidePopupMenu | Hides the popup menu. |
HideSmartTag | Hides the smart tag. |
IsAvailable | Returns true if the smart tag provider is available for the current context. |
ShowPopupMenu(Point) | Displays the popup menu inside the code editor at the specified position. |
ShowPopupMenu(Point, Boolean) | Displays the popup menu inside the code editor at the specified position. The boolean parameter specifies whether to show a notification if no items are available for this smart tag provider. |
ShowSmartTag | Shows the smart tag. |
See the “How to use DXCore SmartTagProvider component and create your own Popup menu entry” topic, to learn more on SmartTagProvider usage.
—– Products: DXCore Versions: 10.2 and up VS IDEs: any Updated: May/24/2011 ID: D085