ProvideToolWindowAttribute Class

Notifies Visual Studio that a VSPackage owns a tool window.

Namespace:  Microsoft.VisualStudio.Shell
Assemblies:   Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)
  Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)
  Microsoft.VisualStudio.Shell.9.0 (in Microsoft.VisualStudio.Shell.9.0.dll)

Syntax

声明
<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple := True, Inherited := True)> _
Public NotInheritable Class ProvideToolWindowAttribute _
    Inherits RegistrationAttribute
用法
Dim instance As ProvideToolWindowAttribute
[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public sealed class ProvideToolWindowAttribute : RegistrationAttribute
[AttributeUsageAttribute(AttributeTargets::Class, AllowMultiple = true, Inherited = true)]
public ref class ProvideToolWindowAttribute sealed : public RegistrationAttribute
[<SealedAttribute>]
[<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = true, Inherited = true)>]
type ProvideToolWindowAttribute =  
    class
        inherit RegistrationAttribute
    end
public final class ProvideToolWindowAttribute extends RegistrationAttribute

Remarks

When to Call

Implement the ProvideToolWindowAttribute class when a VSPackage implements one or more tool windows.

Basic Usage

This attribute declares that a specific VSPackage owns a tool window. It also helps determine the positioning and persistence of the tool window when it is created. To use ProvideToolWindowAttribute, place it on a package class derived from Package or implementing IVsPackage.

This attribute is only used to provide data for external registration tools. It does not have any effect on the runtime behavior of the VSPackage.

Registry Entries

  • The ProvideToolWindowAttribute class creates the following registry entries:

  • <VSROOT>\ToolWindows\{ToolWindowGuid}

  • <VSROOT>\ToolWindows\{ToolWindowGuid}\@={ToolWindowTypeGuid}

  • <VSROOT>\ToolWindows\{ToolWindowGuid}\Name=ToolWindowName

  • The following registry entries are optional:

  • <VSROOT>\ToolWindows\{ToolWindowGuid}\Float=FloatPosition

  • <VSROOT>\ToolWindows\{ToolWindowGuid}\Style=ToolWindowStyle

  • <VSROOT>\ToolWindows\{ToolWindowGuid}\Window=DockWith

  • <VSROOT>\ToolWindows\{ToolWindowGuid}\Orientation=ToolWindowOrientation

Samples

You can find an implementation of the ProvideToolWindowAttribute class in the Managed Single-Instance Tool Window sample. The standard location for this and all other attributes used for automatic registration is adjacent to the implementation of the Package class in VsPkg.cs, VsPkg.vb, or VsPkg.cpp, depending on the language used in the sample.

Inheritance Hierarchy

System.Object
  System.Attribute
    Microsoft.VisualStudio.Shell.RegistrationAttribute
      Microsoft.VisualStudio.Shell.ProvideToolWindowAttribute

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

ProvideToolWindowAttribute Members

Microsoft.VisualStudio.Shell Namespace