LookupBindingPropertiesAttribute 类   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指定支持基于查找的绑定的属性。 此类不能被继承。
public ref class LookupBindingPropertiesAttribute sealed : Attribute[System.AttributeUsage(System.AttributeTargets.Class)]
public sealed class LookupBindingPropertiesAttribute : Attribute[<System.AttributeUsage(System.AttributeTargets.Class)>]
type LookupBindingPropertiesAttribute = class
    inherit AttributePublic NotInheritable Class LookupBindingPropertiesAttribute
Inherits Attribute- 继承
- 属性
示例
下面的代码示例演示与基于查找的绑定一起使用的属性。
// 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
属性 LookupBindingPropertiesAttribute 必须包含所有四个成员,取消设置值时除外。 下面的代码示例演示 了 控件 ComboBox 。
// 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 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 通过指定任何参数来取消设置 特性。
// 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
注解
LookupBindingPropertiesAttribute用于指定用于基于查找的绑定的属性,尤其是 ListBox 和 ComboBox 控件。
在 LookupBindingPropertiesAttribute 类级别指定 。 类可以继承,不允许在同一类上使用多个属性。
构造函数
| LookupBindingPropertiesAttribute() | 不使用任何参数初始化 LookupBindingPropertiesAttribute 类的新实例。 | 
| LookupBindingPropertiesAttribute(String, String, String, String) | 初始化 LookupBindingPropertiesAttribute 类的新实例。 | 
字段
| Default | 表示 LookupBindingPropertiesAttribute 类的默认值。 | 
属性
| DataSource | 获取 LookupBindingPropertiesAttribute 所绑定组件的数据源属性的名称。 | 
| DisplayMember | 获取 LookupBindingPropertiesAttribute 所绑定组件的显示成员属性的名称。 | 
| LookupMember | 获取此特性所绑定组件的查找成员的名称。 | 
| TypeId | 在派生类中实现时,获取此 Attribute 的唯一标识符。(继承自 Attribute) | 
| ValueMember | 获取 LookupBindingPropertiesAttribute 所绑定组件的值成员属性的名称。 | 
方法
| Equals(Object) | 确定指定的 Object 是否等同于当前的 LookupBindingPropertiesAttribute 实例。 | 
| GetHashCode() | 返回此实例的哈希代码。 | 
| GetType() | 获取当前实例的 Type。(继承自 Object) | 
| IsDefaultAttribute() | 在派生类中重写时,指示此实例的值是否是派生类的默认值。(继承自 Attribute) | 
| Match(Object) | 当在派生类中重写时,返回一个指示此实例是否等于指定对象的值。(继承自 Attribute) | 
| MemberwiseClone() | 创建当前 Object 的浅表副本。(继承自 Object) | 
| ToString() | 返回表示当前对象的字符串。(继承自 Object) | 
显式接口实现
| _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) | 将一组名称映射为对应的一组调度标识符。(继承自 Attribute) | 
| _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) | 检索对象的类型信息,然后可以使用该信息获取接口的类型信息。(继承自 Attribute) | 
| _Attribute.GetTypeInfoCount(UInt32) | 检索对象提供的类型信息接口的数量(0 或 1)。(继承自 Attribute) | 
| _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) | 提供对某一对象公开的属性和方法的访问。(继承自 Attribute) |