Partilhar via


Método AttributeTableBuilder.CreateTable

Cria uma tabela de atributo que contém todas as definições de atributo fornecidas através de AddCustomAttributes chamadas.

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

Sintaxe

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 de retorno

Tipo: Microsoft.Windows.Design.Metadata.AttributeTable
Um atributo tabela pode ser passada para o Repositório de Metadados.

Comentários

A tabela é um instantâneo do estado corrente do construtor de atributo.Qualquer subseqüentes AddCustomAttributes chamadas não são incluídas na tabela. Se forem usados métodos de retorno de chamada para declarar atributos, esses métodos não serão avaliados durante CreateTable. Em vez disso, a tabela conterá sistema autônomo retornos de chamada e vai avaliá-las conforme necessário.

Exemplos

O seguinte código exemplo mostra como compilação um AttributeTable e adicione-o para o Repositório de Metadados. The Metadata classe anexa um provedor de adorno em um controle. Para obter mais informações, consulte Demonstra Passo a passo: Criando um Adorner de tempo de design.

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

Permissões

Consulte também

Referência

AttributeTableBuilder Classe

Membros AttributeTableBuilder

Namespace Microsoft.Windows.Design.Metadata

AttributeTable

AttributeCallbackBuilder

Outros recursos

Armazenamento de metadados