DataBindingHandlerAttribute Classe

Definição

Especifica uma classe de tempo de design que executa a associação de dados de controles em um designer.Specifies a design-time class that performs data binding of controls within a designer. Essa classe não pode ser herdada.This class cannot be inherited.

public ref class DataBindingHandlerAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class)]
public sealed class DataBindingHandlerAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class)>]
type DataBindingHandlerAttribute = class
    inherit Attribute
Public NotInheritable Class DataBindingHandlerAttribute
Inherits Attribute
Herança
DataBindingHandlerAttribute
Atributos

Exemplos

O exemplo de código a seguir define um manipulador de vinculação de dados, chamado MyDataBindingHandler , a ser usado pelo designer no modo de edição.The following code example defines a data-binding handler, named MyDataBindingHandler, to be used by the designer in editing mode. Ao sair do modo de edição, o Text valor da propriedade é exibido.On exiting the editing mode, the Text property value is displayed.


using System;
using System.Collections;
using System.Web.UI;
using System.Web.UI.Design;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.ComponentModel.Design;

namespace CustomControls
{
  [
    DataBindingHandler(typeof(MyDataBindingHandler)),
    ToolboxData("<{0}:MyLabel runat=server></{0}:MyLabel>")
  ]
  public class MyLabel : Label 
  {
    public  MyLabel()
    { 
      // Insert your code here.
    } 
  }

  public class MyDataBindingHandler : DataBindingHandler
  {
    public override void DataBindControl(IDesignerHost host, Control control)
    {
      ((Label)control).Text = "Added by data binding handler.";
    }
  }
}


Namespace CustomControls

  <DataBindingHandler(GetType(MyDataBindingHandler)), ToolboxData("<{0}:MyLabel runat=server></{0}:MyLabel>")>  _
    Public Class MyLabel
      Inherits Label
      
      Public Sub New()
        'Insert your code here.
      End Sub
      
    End Class
   
    Public Class MyDataBindingHandler
      Inherits DataBindingHandler
      
      Public Overrides Sub DataBindControl(host As IDesignerHost, control As Control)
         CType(control, Label).Text = "Added by data binding handler."
      End Sub
      
    End Class
    
End Namespace 'CustomControls 

Comentários

Para obter mais informações sobre como usar atributos, consulte atributos.For more information about using attributes, see Attributes.

Construtores

DataBindingHandlerAttribute()

Inicializa uma nova instância da classe DataBindingHandlerAttribute não usando nenhum parâmetro.Initializes a new instance of the DataBindingHandlerAttribute class using no parameters. Esse é o construtor sem parâmetros.This is the parameterless constructor.

DataBindingHandlerAttribute(String)

Inicializa uma nova instância da classe DataBindingHandlerAttribute com o nome do tipo especificado.Initializes a new instance of the DataBindingHandlerAttribute class with the specified type name.

DataBindingHandlerAttribute(Type)

Inicializa uma nova instância da classe DataBindingHandlerAttribute do Type especificado.Initializes a new instance of the DataBindingHandlerAttribute class of the specified Type.

Campos

Default

Define o atributo padrão para classe DataBindingHandlerAttribute.Defines the default attribute for the DataBindingHandlerAttribute class.

Propriedades

HandlerTypeName

Obtém o nome do tipo do manipulador de associação de dados.Gets the type name of the data-binding handler.

TypeId

Quando implementado em uma classe derivada, obtém um identificador exclusivo para este Attribute.When implemented in a derived class, gets a unique identifier for this Attribute.

(Herdado de Attribute)

Métodos

Equals(Object)

Determina se duas instâncias de objeto são iguais.Determines whether two object instances are equal.

Equals(Object)

Retorna um valor que indica se essa instância é igual a um objeto especificado.Returns a value that indicates whether this instance is equal to a specified object.

(Herdado de Attribute)
GetHashCode()

Retorna o código hash para a instância.Returns the hash code for this instance.

GetHashCode()

Retorna o código hash para a instância.Returns the hash code for this instance.

(Herdado de Attribute)
GetType()

Obtém o Type da instância atual.Gets the Type of the current instance.

(Herdado de Object)
IsDefaultAttribute()

Quando substituído em uma classe derivada, indica se o valor dessa instância é o valor padrão para a classe derivada.When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(Herdado de Attribute)
Match(Object)

Quando substituído em uma classe derivada, retorna um valor que indica se essa instância é igual a um objeto especificado.When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(Herdado de Attribute)
MemberwiseClone()

Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object.

(Herdado de Object)
ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.Returns a string that represents the current object.

(Herdado de Object)

Implantações explícitas de interface

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Mapeia um conjunto de nomes para um conjunto correspondente de identificadores de expedição.Maps a set of names to a corresponding set of dispatch identifiers.

(Herdado de Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Recupera as informações de tipo para um objeto, que pode ser usado para obter as informações de tipo para uma interface.Retrieves the type information for an object, which can be used to get the type information for an interface.

(Herdado de Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Retorna o número de interfaces de informações do tipo que um objeto fornece (0 ou 1).Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Herdado de Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Fornece acesso a propriedades e métodos expostos por um objeto.Provides access to properties and methods exposed by an object.

(Herdado de Attribute)

Aplica-se a

Confira também