MetadataStore Class

A container of custom design-time attributes.

Namespace:  Microsoft.Windows.Design.Metadata
Assembly:  Microsoft.Windows.Design (in Microsoft.Windows.Design.dll)

Syntax

'Declaration
Public NotInheritable Class MetadataStore
'Usage
You do not need to declare an instance of a static class in order to access its members.
public static class MetadataStore
public ref class MetadataStore abstract sealed
public final class MetadataStore

Remarks

Use the MetadataStore class to attach custom design-time attributes to types. Specify the custom attributes in an AttributeTable, which you create with an AttributeTableBuilder.

Add the attribute table to the metadata store by using the AddAttributeTable method. Once added, these attributes appear when you call TypeDescriptor methods.

Examples

The following code example shows how to create an AttributeTable to associate an adorner provider with a control class. For more information, see Walkthrough: Creating a Design-time Adorner.

' Container for any general design-time metadata to initialize. 
' Designers look for a type in the design-time assembly that  
' implements IRegisterMetadata. If found, designers instantiate  
' this class and call its Register() method automatically. 
Friend Class Metadata
    Implements IRegisterMetadata

    ' Called by the designer to register any design-time metadata. 
    Public Sub Register() Implements IRegisterMetadata.Register
        Dim builder As New AttributeTableBuilder()

        ' Add the adorner provider to the design-time metadata.
        builder.AddCustomAttributes(GetType(ButtonWithDesignTime), _
                                    New FeatureAttribute(GetType(OpacitySliderAdornerProvider)))

        MetadataStore.AddAttributeTable(builder.CreateTable())
    End Sub 

End Class
// Container for any general design-time metadata to initialize. 
// Designers look for a type in the design-time assembly that  
// implements IRegisterMetadata. If found, designers instantiate  
// this class and call its Register() method automatically. 
internal class Metadata : IRegisterMetadata
{
    // Called by the designer to register any design-time metadata. 
    public void Register()
    {
        AttributeTableBuilder builder = new AttributeTableBuilder();

        // Add the adorner provider to the design-time metadata.
        builder.AddCustomAttributes(
            typeof(ButtonWithDesignTime), 
            new FeatureAttribute(typeof(OpacitySliderAdornerProvider)));

        MetadataStore.AddAttributeTable(builder.CreateTable());
    }
}

Inheritance Hierarchy

System.Object
  Microsoft.Windows.Design.Metadata.MetadataStore

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

MetadataStore Members

Microsoft.Windows.Design.Metadata Namespace

AttributeTable

AttributeTableBuilder

Other Resources

Metadata Store