VisibilityItem Element

The VisibilityItem element determines the static visibility of commands and toolbars. Each entry identifies a command or menu and an associated command user interface (UI) context. The visibility is first controlled by the Visual Studio integrated development environment (IDE) without loading the VSPackage.

After your VSPackage is loaded, the IDE relies on your commands to determine their visibility instead of the static visibility defined in VisibilityItem. In an unmanaged VSPackage, implement QueryStatus; in a managed VSPackage, handle the BeforeQueryStatus event.

A command or menu with a VisibilityItem will appear only when the associated context is active. The VisibilityItem only applies to commands and menus, not to groups. Commands and menus not included in this section are visible whenever their parent menu is active. A command or menu may be associated with multiple command UI contexts by including an entry for each command/context combination. Separate the combinations by using a logical OR.

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute

Description

guid

Required.

id

Required.

context

Required. The UI context in which the command is visible.

context="guidNotViewSourceMode"

Condition

Optional. See VSCT XML Schema Conditional Attributes.

Child Elements

None

Parent Elements

Element

Description

VisibilityConstraints Element

The VisibilityConstraints element determines the static visibility of groups of commands and toolbars. The visibility is first controlled by the Visual Studio integrated development environment (IDE) without loading the VSPackage.

Example

<VisibilityConstraints>
  <VisibilityItem guid="cmdSetGuidMyProductCommands"     id="cmdidAddWidget"
    context="guidNotViewSourceMode"/>
</VisibilityConstraints>

See Also

Concepts

VisibilityConstraints Element

Visual Studio Command Table (.Vsct) Files