UI Automation Support for the MenuBar Control Type

 
System_CAPS_ICON_note.jpg Note

This documentation is intended for .NET Framework developers who want to use the managed UI Automation classes defined in the System.Windows.Automation namespace. For the latest information about UI Automation, see Windows Automation API: UI Automation.

This topic provides information about UI Automation support for the MenuBar control type. In UI Automation, a control type is a set of conditions that a control must meet in order to use the ControlTypeProperty property. The conditions include specific guidelines for UI Automation tree structure, UI Automation property values and control patterns.

Menu bar controls are an example of controls that implement the MenuBar control type. Menu bars provide a means for users to activate commands and options contained in an application.

The following sections define the required UI Automation tree structure, properties, control patterns, and events for the MenuBar control type. The UI Automation requirements apply to all list controls, whether Windows Presentation Foundation (WPF), Win32, or Windows Forms.

The following table depicts the control view and the content view of the UI Automation tree that pertains to menu bar controls and describes what can be contained in each view. For more information on the UI Automation tree, see UI Automation Tree Overview.

Control ViewContent View
MenuBar

- MenuItem (1 or more)
- Other controls (0 or many)
MenuBar

- MenuItem (1 or more)
- Other controls (0 or many)

Menu bar controls can contain other controls such as edit controls and combo boxes within its structure. These additional controls correspond to the "other controls" listed above in the control and content views.

The following table lists the UI Automation properties whose value or definition is especially relevant to the menu bar controls. For more information on UI Automation properties, see UI Automation Properties for Clients.

UI Automation PropertyValueNotes
BoundingRectanglePropertySee notes.The value exposed by this property must include all of the controls contained within it.
NamePropertySee notes.The menu bar control does not need a name unless an application has more than one menu bar. If there is more than one menu bar in an application, then this property should be used to expose distinguishing names, such as "Formatting" or "Outlining."
LabeledByPropertyNullMenu bar controls never have a label.
ControlTypePropertyMenuBarThis value is the same for all UI frameworks.
LocalizedControlTypeProperty"menu bar"Localized string corresponding to the MenuBar control type.
IsContentElementPropertyTrueThe menu bar control is always included in the content view of the UI Automation tree.
IsControlElementPropertyTrueThe menu bar control is always included in the control view of the UI Automation tree.
IsOffscreenPropertySee notes.The value of this property depends on whether the control is viewable on the screen.
OrientationPropertyDependsThis property exposes whether the menu bar control is horizontal or vertical.
IsKeyboardFocusablePropertyTrueMenu bar controls are keyboard-focusable because the controls they contain can take keyboard focus.
HelpTextPropertySee notes.No scenarios for when Help text is required for a menu bar control.
AcceleratorKeyPropertyNullMenu bars never have accelerator keys.
AccessKeyProperty"ALT"Pressing the ALT key should always bring focus to the menu bar within the application.

The following table lists the UI Automation control patterns required to be supported by menu bar controls. For more information on control patterns, see UI Automation Control Patterns Overview.

Control PatternSupportNotes
IExpandCollapseProviderDependsIf the control can be expanded or collapsed, implement IExpandCollapseProvider.
IDockProviderDependsIf the control can be docked to different parts of the screen, implement IDockProvider.
ITransformProviderDependsIf the control can be resized, rotated or moved it must implement ITransformProvider.

The following table lists the UI Automation events required to be supported by all menu bar controls. For more information on events, see UI Automation Events Overview.

UI Automation EventSupport/ValueNotes
BoundingRectangleProperty property-changed event.RequiredNone
IsOffscreenProperty property-changed event.RequiredNone
IsEnabledProperty property-changed event.RequiredNone
ExpandCollapseStateProperty property-changed event.DependsNone
AutomationFocusChangedEventRequiredNone
StructureChangedEventRequiredNone

MenuBar
UI Automation Control Types Overview
UI Automation Overview

Show: