Compartir a través de


ProvideToolboxFormatAttribute Class

Definition

Apply this attribute to classes implementing VSPackages to declare that the VSPackage provides Toolbox items with the specified clipboard format and to enable drag-and-drop support in the Visual Studio Toolbox.

public ref class ProvideToolboxFormatAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true, Inherited=true)]
public sealed class ProvideToolboxFormatAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true, Inherited=true)>]
type ProvideToolboxFormatAttribute = class
    inherit Attribute
Public NotInheritable Class ProvideToolboxFormatAttribute
Inherits Attribute
Inheritance
ProvideToolboxFormatAttribute
Attributes

Examples

In the example below the attributes applied to the MyPackage class indicates that it supports version 1 of Toolbox items with two clipboard formats: "CF_XMLCODE" and "InPlaceMenuEditorMenu".

[DefaultRegistryRoot("Software\\Microsoft\\VisualStudio\\8.0")]  
[ProvideToolboxItems(true, 1)]  
[ProvideToolboxFormat("CF_XMLCODE")]  
[ProvideToolboxFormat("InPlaceMenuEditorMenu")]  
[Guid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")]  
internal sealed class MyPackage : Package  

Remarks

Attribute Context

Applies to Classes providing VSPackages by implementing the IVsPackage interface or the Package interface.
Repeatable Yes
Required attributes ProvideToolboxItemsAttribute
Invalid attributes None

This attribute is used only for registration purposes and does not affect runtime behavior.

Apply this attribute to classes implementing a VSPackage that either provides Toolbox items with a non-standard clipboard format or does not support one or more the default Toolbox clipboard formats.

A VSPackage without this attribute must support all default Toolbox clipboard types.

For a list of the default Toolbox clipboard types supported by a VSPackage, see Extending the Toolbox.

Use of this attribute by itself does not register a VSPackage as a provider of items with a given clipboard. An instance of the attribute must be applied to register the VSPackage as providing objects of the specified format.

Only one clipboard format is registered as supported for each instance of this attribute applied to a class. To indicate that multiple formats are supported, multiple instances of the attribute must be applied to the class.

Note C# automatically appends the word "Attribute" to the name of any attribute class. In C# code, refer to this attribute as ProvideToolboxFormat.

Constructors

ProvideToolboxFormatAttribute(String)

Initializes a new instance of ProvideToolboxFormatAttribute for the specified format.

Properties

Format

Gets the name of a supported clipboard format.

Applies to