Actions Pane Help Label Sample


This sample runs only in Microsoft Office Excel 2007 and Microsoft Office Word 2007.

This sample includes a control that provides dynamic, context-sensitive help on an actions pane for a document or worksheet that contains XML-mapped regions. The control automatically associates itself with the XML schema and uses schema annotations as the help text. When a user places the insertion point in a region that contains an XML node, the control displays the associated region name and annotation text. The developer can use the control’s properties to indicate what happens when a region does not have annotation text.

The control has four properties that you can set to determine what the control displays if there is no annotation text. These properties appear in the Properties window, in a section called Content.

  • UseAncestorAnnotation
    Specifies whether the control should display the annotation text of the closest ancestor region if one is not specified in the selected region.

  • AnnotationType
    Determines whether the element type or element name annotation is displayed.

  • PlaceholderText
    The text the control displays if there is no annotation.

  • ShowLocationName
    Toggles whether the name of the region appears in the Help Label control.

There is one solution with three projects in the Help Label sample: a control library project, a Word document project, and an Excel workbook project. The Word and Excel projects demonstrate how to use the control. As you click in different areas of the document or worksheet, the Help Label displays text that is taken from the associated XML schema region.

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.


This sample demonstrates how to create a user control and incorporate it into a project, and how to respond to events in XML-mapped regions.

See Also


XML Schemas and Data (Visual Studio Tools for Office)

Actions Pane Overview

UI Customization Walkthroughs

Other Resources

Document-Level Samples