Events.CommandBarEvents Property (Object)


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

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

object this[
	object CommandBarControl
] { get; }


Type: System.Object

Required. The CommandBar control that causes the event to fire.

Property Value

Type: System.Object

A CommandBarEvents object.

The CommandBarEvents property is used 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.

You must set the OnAction property to some string value. You can set this value after the CommandBarEvents property is called, and can reset it to a blank string, which disconnects the event. If you create a control without setting the OnAction property to a valid string value, then no event is raised on the event object returned by the CommandBarEvents property.

Return to top