Remarque
L’accès à cette page nécessite une autorisation. Vous pouvez essayer de vous connecter ou de modifier des répertoires.
L’accès à cette page nécessite une autorisation. Vous pouvez essayer de modifier des répertoires.
Mise à jour : novembre 2007
Attache les métadonnées au moment du design à un type de contrôle particulier.
Espace de noms : Microsoft.Windows.Design.Metadata
Assembly : Microsoft.Windows.Design (dans Microsoft.Windows.Design.dll)
Syntaxe
Sub Register
Dim instance As IRegisterMetadata
instance.Register()
void Register()
void Register()
function Register()
Notes
La méthode Register est appelée pendant l'initialisation du concepteur.
Les classes qui implémentent la méthode Register doivent utiliser la méthode AddAttributeTable pour ajouter les métadonnées au magasin.
Exemples
L'exemple de code suivant montre comment implémenter la méthode Register. La classe Metadata attache un fournisseur d'ornements à un contrôle. Pour plus d'informations, consultez Procédure pas à pas : création d'un ornement au moment du 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());
}
}
Autorisations
- Confiance totale accordée à l'appelant immédiat. Ce membre ne peut pas être utilisé par du code d'un niveau de confiance partiel. Pour plus d'informations, consultez Utilisation de bibliothèques à partir de code d'un niveau de confiance partiel.
Voir aussi
Référence
Microsoft.Windows.Design.Metadata, espace de noms