IRegisterMetadata.Register (Método)

Actualización: noviembre 2007

Asocia los metadatos en tiempo de diseño a un tipo de control determinado.

Espacio de nombres:  Microsoft.Windows.Design.Metadata
Ensamblado:  Microsoft.Windows.Design (en Microsoft.Windows.Design.dll)

Sintaxis

Sub Register

Dim instance As IRegisterMetadata

instance.Register()
void Register()
void Register()
function Register()

Comentarios

Se llama al método Register durante la inicialización del diseñador.

Las clases que implementan el método Register debe utilizar el método AddAttributeTable para agregar metadatos al almacén.

Ejemplos

En el siguiente ejemplo de código se muestra cómo implementar el método Register. La clase Metadata asocia un proveedor de adornos a un control. Para obtener más información, consulte Tutorial: Crear un adorno en tiempo de diseño.

' 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());
    }
}

Permisos

Vea también

Referencia

IRegisterMetadata (Interfaz)

IRegisterMetadata (Miembros)

Microsoft.Windows.Design.Metadata (Espacio de nombres)

MetadataStore

Otros recursos

Almacén de metadatos