IRegisterMetadata Interface

Specifies a class that requests extra attributes to be added to the metadata store.

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

Syntax

'Declaration
Public Interface IRegisterMetadata
'Usage
Dim instance As IRegisterMetadata
public interface IRegisterMetadata
public interface class IRegisterMetadata
public interface IRegisterMetadata

Remarks

Implement the IRegisterMetadata interface to provide custom attributes for defining the design-time behavior and appearance of Windows Presentation Foundation (WPF) controls. Each design-time metadata assembly must include a type that implements IRegisterMetadata.

Examples

The following code example shows how to implement the IRegisterMetadata interface. The Metadata class attaches an adorner provider to a control. 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());
    }
}

See Also

Reference

IRegisterMetadata Members

Microsoft.Windows.Design.Metadata Namespace

MetadataStore

Other Resources

Metadata Store