LookupBindingPropertiesAttribute LookupBindingPropertiesAttribute LookupBindingPropertiesAttribute LookupBindingPropertiesAttribute Class

定义

指定支持基于查找的绑定的属性。Specifies the properties that support lookup-based binding. 此类不能被继承。This class cannot be inherited.

public ref class LookupBindingPropertiesAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class)]
public sealed class LookupBindingPropertiesAttribute : Attribute
type LookupBindingPropertiesAttribute = class
    inherit Attribute
Public NotInheritable Class LookupBindingPropertiesAttribute
Inherits Attribute
继承
LookupBindingPropertiesAttributeLookupBindingPropertiesAttributeLookupBindingPropertiesAttributeLookupBindingPropertiesAttribute
属性

示例

下面的代码示例演示了用于基于查找的绑定的属性。The following code example shows properties used with lookup-based binding.

// The DemoControl class shows properties 
// used with lookup-based binding.
[LookupBindingProperties(
    "DataSource", 
    "DisplayMember", 
    "ValueMember", 
    "LookupMember")]
public class DemoControl : Control
{   
}
' The DemoControl class shows properties 
' used with lookup-based binding.
<LookupBindingProperties( _
"DataSource", _
"DisplayMember", _
"ValueMember", _
"LookupMember")> _
Public Class DemoControl
    Inherits Control
End Class

除了取消设置值时,属性必须包括所有四个成员。LookupBindingPropertiesAttributeThe LookupBindingPropertiesAttribute attribute must include all four members, except when unsetting values. 下面的代码示例演示ComboBox控件。The following code example shows the ComboBox control.

// The DemoComboBox control shows a standard
// combo box binding definition.
[LookupBindingProperties(
    "DataSource", 
    "DisplayMember", 
    "ValueMember", 
    "SelectedValue")]
public class DemoComboBox : Control
{
}
' The DemoComboBox control shows a standard
' combo box binding definition.
<LookupBindingProperties( _
"DataSource", _
"DisplayMember", _
"ValueMember", _
"SelectedValue")> _
Public Class DemoComboBox
    Inherits Control
End Class

下面的代码示例演示控件可以支持简单绑定和列表绑定。The following code example shows that a control can support both simple binding as well as list binding.

// The DemoComboBox2 class shows that a control can
// support both simple binding as well as list binding.
[LookupBindingProperties(
    "DataSource", 
    "DisplayMember", 
    "ValueMember", 
    "SelectedValue")]
[DefaultBindingProperty("Text")]
public class DemoComboBox2 : Control 
{
}
' The DemoComboBox2 class shows that a control can
' support both simple binding as well as list binding.
<LookupBindingProperties( _
"DataSource", _
"DisplayMember", _
"ValueMember", _
"SelectedValue"), _
DefaultBindingProperty("Text")> _
Public Class DemoComboBox2
    Inherits Control
End Class

下面的代码示例演示LookupBindingPropertiesAttribute了可以通过不指定参数来设置属性。The following code example shows that the LookupBindingPropertiesAttribute attribute can be unset by specifying no arguments.

// NonBindableCombo control shows how to unset the
// LookupBindingProperties by specifying no arguments.
[LookupBindingProperties()]
public class NonBindableCombo : Control
{
}
' NonBindableCombo control shows how to unset the
' LookupBindingProperties by specifying no arguments.
<LookupBindingProperties()>  _
Public Class NonBindableCombo
    Inherits Control
End Class

注解

用于指定用于基于查找的绑定的属性, ComboBox特别ListBox是控件。 LookupBindingPropertiesAttributeThe LookupBindingPropertiesAttribute is used to specify the properties used with lookup-based binding, particularly ListBox and ComboBox controls.

LookupBindingPropertiesAttribute在类级别指定。The LookupBindingPropertiesAttribute is specified at the class level. 类可以继承, 并且不允许在同一类上存在多个属性。The class can be inherited and does not allow multiple attributes on the same class.

构造函数

LookupBindingPropertiesAttribute() LookupBindingPropertiesAttribute() LookupBindingPropertiesAttribute() LookupBindingPropertiesAttribute()

不使用任何参数初始化 LookupBindingPropertiesAttribute 类的新实例。Initializes a new instance of the LookupBindingPropertiesAttribute class using no parameters.

LookupBindingPropertiesAttribute(String, String, String, String) LookupBindingPropertiesAttribute(String, String, String, String) LookupBindingPropertiesAttribute(String, String, String, String) LookupBindingPropertiesAttribute(String, String, String, String)

初始化 LookupBindingPropertiesAttribute 类的新实例。Initializes a new instance of the LookupBindingPropertiesAttribute class.

字段

Default Default Default Default

表示 LookupBindingPropertiesAttribute 类的默认值。Represents the default value for the LookupBindingPropertiesAttribute class.

属性

DataSource DataSource DataSource DataSource

获取 LookupBindingPropertiesAttribute 所绑定组件的数据源属性的名称。Gets the name of the data source property for the component to which the LookupBindingPropertiesAttribute is bound.

DisplayMember DisplayMember DisplayMember DisplayMember

获取 LookupBindingPropertiesAttribute 所绑定组件的显示成员属性的名称。Gets the name of the display member property for the component to which the LookupBindingPropertiesAttribute is bound.

LookupMember LookupMember LookupMember LookupMember

获取此特性所绑定组件的查找成员的名称。Gets the name of the lookup member for the component to which this attribute is bound.

TypeId TypeId TypeId TypeId

在派生类中实现时,获取此 Attribute 的唯一标识符。When implemented in a derived class, gets a unique identifier for this Attribute.

(Inherited from Attribute)
ValueMember ValueMember ValueMember ValueMember

获取 LookupBindingPropertiesAttribute 所绑定组件的值成员属性的名称。Gets the name of the value member property for the component to which the LookupBindingPropertiesAttribute is bound.

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的 Object 是否等同于当前的 LookupBindingPropertiesAttribute 实例。Determines whether the specified Object is equal to the current LookupBindingPropertiesAttribute instance.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

返回此实例的哈希代码。Returns the hash code for this instance.

GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
IsDefaultAttribute() IsDefaultAttribute() IsDefaultAttribute() IsDefaultAttribute()

在派生类中重写时,指示此实例的值是否是派生类的默认值。When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(Inherited from Attribute)
Match(Object) Match(Object) Match(Object) Match(Object)

当在派生类中重写时,返回一个指示此实例是否等于指定对象的值。When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(Inherited from Attribute)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

显式界面实现

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

将一组名称映射为对应的一组调度标识符。Maps a set of names to a corresponding set of dispatch identifiers.

(Inherited from Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

检索对象的类型信息,然后可以使用该信息获取接口的类型信息。Retrieves the type information for an object, which can be used to get the type information for an interface.

(Inherited from Attribute)
_Attribute.GetTypeInfoCount(UInt32) _Attribute.GetTypeInfoCount(UInt32) _Attribute.GetTypeInfoCount(UInt32) _Attribute.GetTypeInfoCount(UInt32)

检索对象提供的类型信息接口的数量(0 或 1)。Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Inherited from Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供对某一对象公开的属性和方法的访问。Provides access to properties and methods exposed by an object.

(Inherited from Attribute)

适用于

另请参阅