Share via


Context-Sensitive Help Overview

Context-sensitive Help is information that applies to the specific area of the integrated development environment (IDE) in which you are working.

This information is provided at run time in the Dynamic Help window, when a user selects items or user interface (UI) elements, or when a user presses F1. Help authors and developers work together to create context-sensitive Help. The Help author creates a compiled Help (.HxS) file or an XML file containing Help topics, F1 keywords, lookup keywords, and attributes. This Help file resides in the information provider, which refers to the group of compiled Help files registered on the system. The Help developer modifies the program code so that the correct topic is displayed when a user requests Help. For more information, see Connecting Context-Sensitive Help.

Components of Context

Context is composed of F1 keywords, lookup keywords, and attributes.

  • F1 keywords provide Help that is accessed when a user selects a context element (such as a tool window, editor, or modal dialog box) and then either:

    • Presses F1, or

    • Chooses among the page titles displayed in the Dynamic Help window

  • Lookup keywords provide a list of background or related topics that are shown in the Dynamic Help window. The list of keyword topics in the Dynamic Help window updates when a user changes the current selection. Lookup keywords are derived from the same source as the keywords shown in the index of a compiled Help file.

  • Attributes are name-value pairs that are used to filter the F1 and lookup keyword topics shown in the Dynamic Help window or displayed when a user presses F1.

Keyword and attribute context is stored in a context bag, which is an object attached to a context provider. Context providers, which are components that can be selected, include tool windows, editors, language services, and hierarchies. Each context provider contains one context bag, but each context bag can additionally point to multiple subcontext bags that are linked to it. For more information, see How to: Create a Context Bag or Subcontext Bag.

Subcontext is attribute and keyword context provided for selected items within tool windows, editors, and language services. Examples include a keyword in an editor or a command in a tool window (for example, the Command window). Subcontext is stored in a subcontext bag — a separate IVsUserContext object linked to the parent context bag. The parent context bag points to any subcontext bags linked to it, thus allowing the subcontext to be included in the larger context. For more information, see Context and Subcontext Bags.

At any given time, the keywords and attributes present in both the context bag and any subcontext bags represent the context for the context provider. The union of the context and subcontext bags on all context providers within the active selection describes the overall context for the IDE, and thus the context that is shown in the Dynamic Help window. For more information, see Active Context.

The following diagram illustrates how context and subcontext are passed from the various context providers to the Dynamic Help window.

Passing context and subcontext

Overview of Context Sensitive Help

Context bags are attached to various context providers. At the appropriate time, the IDE's selection service determines the active selection (current tool window, editor or designer, hierarchy, and so on) and provides this information to the context service. The context service then checks each selection for a context bag. If a context bag is present, then its context is added to the active context collection.

The context service sorts the keywords in the active context collection based on their priority. Keyword priority is based on the context provider with which the keywords are associated. Subcontext is typically given a higher priority than context because it relates to a more specific selection within the context provider. For more information, see Context Priority.

The context service looks up the keywords in one or more information providers and then filters the list of returned topics based on the attributes in the active context collection. All attributes in the active context collection are assigned an equal priority. The list of filtered keyword topics is then displayed, sorted by priority, in the Dynamic Help window. For more information, see Dynamic Help Window Implementation.

See Also

Concepts

Active Context

Dynamic Help Window Implementation

Other Resources

Connecting Context-Sensitive Help

About Context-Sensitive Help