CommandBarEvents Property
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Events.CommandBarEvents Property

Gets an object providing events fired when the supplied CommandBarControl object is clicked.

Namespace: EnvDTE
Assembly: EnvDTE (in envdte.dll)

Object CommandBarEvents [
	[InAttribute] Object CommandBarControl
] { get; }
/** @property */
Object get_CommandBarEvents (/** @attribute InAttribute() */ Object CommandBarControl)

JScript supports the use of indexed properties, but not the declaration of new ones.


Property Value

A CommandBarEvents object.

The CommandBarEvents property is used by an Add-in to connect an event with a click of a Microsoft.VisualStudio.CommandBars.CommandBarControl object, or to connect to the Click event of any member of the Microsoft.VisualStudio.CommandBars.CommandBarControls collection.

The Add-in must set the OnAction property to some string value. It can set this value after the CommandBarEvents property is called, and can reset it to a blank string, which disconnects the event. If an Add-in creates a control and fails to set the OnAction property to some valid string value, then no event is raised on the event object returned by the CommandBarEvents property.

© 2016 Microsoft