This topic has not yet been rated - Rate this topic

IRegisterMetadata.Register Method

.NET Framework 3.5

Attaches design-time metadata to a particular control type.

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

The Register method is called during designer initialization.

Classes that implement the Register method should use the AddAttributeTable method to add metadata to the store.

The following code example shows how to implement the Register method. 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.
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());
    }
}


Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ