ArcObjects Library Reference (SystemUI)  

IToolBarDef Interface

Provides access to members that define a toolbar.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

When To Use

The IToolbarDef interface is used to define the properties of a custom toolbar. When creating your own toolbar, you would implement the IToolBarDef interface in your class code. You can set the caption and name of the toolbar and specify what commanditems are on the toolbar.


Read-only property Caption The caption of this toolbar.
Method GetItemInfo The CLSID for the item on this toolbar at the specified index.
Read-only property ItemCount The number of items in this toolbar.
Read-only property Name The name of this toolbar.

CoClasses that implement IToolBarDef

CoClasses and Classes Description
ControlsEditingToolbar (esriControls) Provides access to the engine editing toolbar.
ControlsFeatureSelectionToolbar (esriControls) A toolbar with common selection tools.
ControlsGlobeGlobeToolbar (esriControls) A toolbar with common globe control tools.
ControlsGlobeRotateToolbar (esriControls) A toolbar with tools to spin or rotate globe.
ControlsGraphicElementToolbar (esriControls) A toolbar with common tools to draw graphic elements.
ControlsInkToolbar (esriControls) A toolbar with tools which manipulate ink.
ControlsMapNavigationToolbar (esriControls) A toolbar with common tools to navigate map.
ControlsNetworkAnalystToolbar (esriControls) Engine Network Analyst Toolbar.
ControlsPageLayoutToolbar (esriControls) A toolbar with common tools working with pagelayout view.
ControlsSceneSceneToolbar (esriControls) A toolbar with common scene control tools.
ControlsSnappingToolbar (esriControls) A toolbar with common snapping commands.
MxGeocodingToolbar (esriLocationUI) Geocoding Toolbar.


The command bars collection uses command bar definitions (either ToolBarDef or MenuDef) to create command bars. For example, a class that implements IToolbarDef is only a definition for a toolbar; it is not actually a toolbar object. Once this class is registered in one of the command bar component categories, the command bars collection uses the definition of the toolbar in your class to create the actual command bar.

When an end user installs your custom toolbar, you may want this toolbar immediately available in the application so that the user doesn't have to manually display that toolbar before using it. You can add a registry setting to make this toolbar automatically appear the first time the application is run after the installation of your toolbar. In the setup program for your toolbar, you can create a new key under:


The key name should be the CLSID of the toolbar. You don't have to set a value for this key.

This graphic shows that a custom toolbar has been added to PremierToolbars in the registry.

The PremierToolbars setting is only used the first time the application is started; if the user subsequently hides the toolbar, no further attempts will be made to show the toolbar on application startup. After the application is started once the value of your PremierToolbars key is set to 1 and is then ignored by the application.

If you are working in Visual Basic you can use the ESRI Compile and Register Add-in to set up this registry key.

.NET Snippets

List ArcMap Visible Toolbars |