Actions Pane Subpane Control Sample


This sample runs only in Microsoft Office Word 2007.

This sample demonstrates custom user controls on an actions pane, and includes a collapsible container control (the subpane control) that helps you organize controls on an actions pane. The sample also shows how to respond to events that are generated from controls hosted on a subpane control.

There is one project in this sample solution: a Word document project that contains the sample control.

Security noteSecurity Note:

This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.

To run this sample

  • Press F5.


The subpane control is a collapsible container that can host other controls such as list boxes and text boxes. You add a user control to your project and then drag and drop one or more subpane controls onto the user control design surface. You can use multiple subpane controls as necessary and populate them with the controls required by the project. You then write code to associate the subpane controls with the document’s actions pane, and then program against the controls on any of the subpanes.

The control has the following properties, methods, and events.


  • Text. The text that appears in the title bar of a subpane.

  • HighlightColor. The color of the title bar when it has been selected by the user.

  • GradientBeginColor. The color beginning on one side of the title bar.

  • GradientEndColor. The color ending on the other side of the title bar.

  • IsExpanded. Indicates whether the subpane is expanded and showing its list of items.

  • IsAnimated. Indicates whether the subpane rolls up or rolls down when it is expanded or collapsed.


  • Expand. Expands the control. This method does nothing if the control is already expanded.

  • Collapse. Collapses the control. This method does nothing if the control is already collapsed.


  • BeforeExpanding. An event that is raised before the control is expanded.

  • BeforeCollapsing. An event that is raised before the control collapses.

  • AfterExpand. An event that is raised after the control is expanded.

  • AfterCollapse. An event that is raised after the control collapses.

See Also


Actions Pane Overview

Other Resources

Document-Level Samples