AttributeTableBuilder.CreateTable (Método)

Actualización: noviembre 2007

Crea una tabla de atributos que contiene todas las definiciones de atributos proporcionadas mediante llamadas AddCustomAttributes.

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

Sintaxis

Public Function CreateTable As AttributeTable

Dim instance As AttributeTableBuilder
Dim returnValue As AttributeTable

returnValue = instance.CreateTable()
public AttributeTable CreateTable()
public:
AttributeTable^ CreateTable()
public function CreateTable() : AttributeTable

Valor devuelto

Tipo: Microsoft.Windows.Design.Metadata.AttributeTable

Tabla de atributos que se puede pasar al almacén de metadatos.

Comentarios

La tabla es una instantánea del estado actual del generador de atributos. Las llamadas AddCustomAttributes subsiguientes no se incluyen en la tabla. Si se usaron métodos de devolución de llamada para declarar atributos, esos métodos no se evaluarán durante CreateTable. En su lugar, la tabla contendrá esas devoluciones de llamada y las evaluará según sea necesario.

Ejemplos

En el siguiente ejemplo de código se muestra cómo generar un objeto AttributeTable y agregarlo al almacén de metadatos. 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

AttributeTableBuilder (Clase)

AttributeTableBuilder (Miembros)

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

AttributeTable

AttributeCallbackBuilder

Otros recursos

Almacén de metadatos