Export (0) Print
Expand All

LookupBindingPropertiesAttribute Class

Specifies the properties that support lookup-based binding. This class cannot be inherited.

Namespace:  System.ComponentModel
Assembly:  System (in System.dll)

[AttributeUsageAttribute(AttributeTargets.Class)]
public sealed class LookupBindingPropertiesAttribute : Attribute

The LookupBindingPropertiesAttribute is used to specify the properties used with lookup-based binding, particularly ListBox and ComboBox controls.

The LookupBindingPropertiesAttribute is specified at the class level. The class can be inherited and does not allow multiple attributes on the same class.

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 LookupBindingPropertiesAttribute attribute must include all four members, except when unsetting values. 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 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 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
{
}

System.Object
  System.Attribute
    System.ComponentModel.LookupBindingPropertiesAttribute

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft