ExpandCollapse Control Pattern
Describes guidelines and conventions for implementing IExpandCollapseProvider, including information about properties, methods, and events. The ExpandCollapse control pattern is used to support controls that visually expand to display more content and collapse to hide content.
For examples of controls that implement this control pattern, see Control Types and Their Supported Control Patterns.
This topic contains the following sections.
- Implementation Guidelines and Conventions
- Required Members for IExpandCollapseProvider
- Related topics
Implementation Guidelines and Conventions
When implementing the ExpandCollapse control pattern, note the following guidelines and conventions:
Aggregate controls, built with child objects that provide the UI with expand/collapse functionality, must support the ExpandCollapse control pattern whereas their child elements do not. For example, a combo box control is built with a combination of list box, button, and edit controls, but it is only the parent combo box that must support the ExpandCollapse control pattern.
An exception is the menu control, which is an aggregate of individual menu item objects. The menu item objects can support the ExpandCollapse control pattern, but the parent menu control cannot. A similar exception applies to the tree and tree item controls.
When the IExpandCollapseProvider::ExpandCollapseState of a control is set to ExpandCollapseState_LeafNode, any ExpandCollapse functionality is currently inactive for the control and the only information that can be obtained using this control pattern is the ExpandCollapseState. If any child objects are subsequently added, the ExpandCollapseState changes and ExpandCollapse functionality is activated.
ExpandCollapseState refers to the visibility of immediate child objects only; it does not refer to the visibility of all descendant objects.
IExpandCollapseProvider::Expand and Collapse functionality is control-specific. The following are examples of this behavior.
- The Office Personal Menu can be a three-state menu item ("Expanded", "Collapsed" and "PartiallyExpanded") where the control specifies the state to adopt when Expand or Collapse is called.
- Calling Expand on a tree item may display all descendants or only immediate children.
- If calling Expand or Collapse on a control maintains the state of its descendants, a visibility change event should be sent, not a state change event. If the parent control does not maintain the state of its descendants when collapsed, the control may destroy all the descendants that are no longer visible and raise a destroyed event; or it may change the ExpandCollapseState for each descendant and raise a visibility change event.
To guarantee navigation, it is desirable for an object to be in the Microsoft UI Automation tree (with appropriate visibility state) regardless of its parents ExpandCollapseState. If descendants are generated on demand, they may only appear in the UI Automation tree after being displayed for the first time or only while they are visible.
Required Members for IExpandCollapseProvider
The following properties, methods, and events are required for implementing the IExpandCollapseProvider interface.
|Required members||Member type||Notes|
|IUIAutomationPropertyChangedEventHandler||Event||This control has no associated events; use this generic event handler.|