Name

ListControl

Synopsis

This is the abstract base class for list-like Control objects, such as the ListBox, ComboBox, and derived classes.

It provides the basic template for data binding through the DataSource, DisplayMember, and ValueMember properties. Simple selection is accomplished with the SelectedIndex and SelectedValue members.

The concrete derived classes will extend these basic features to offer more specific functionality.


public abstract class ListControl : Control {

// Protected Constructors

   protected ListControl();

// Public Instance Properties

   public object DataSource{set; get; }

   public string DisplayMember{set; get; }

   public abstract int SelectedIndex{set; get; }

   public object SelectedValue{set; get; }

   public string ValueMember{set; get; }

// Protected Instance Properties

   protected CurrencyManager DataManager{get; }

// Public Instance Methods

   public string GetItemText(object item);

// Protected Instance Methods

   protected object FilterItemOnProperty(object item);

   protected object FilterItemOnProperty(object item, string field);

   protected override bool IsInputKey(Keys keyData);  // overrides Control

   protected override void OnBindingContextChanged(EventArgs e);  // overrides Control

   protected virtual void OnDataSourceChanged(EventArgs e);

   protected virtual void OnDisplayMemberChanged(EventArgs e);

   protected virtual void OnSelectedIndexChanged(EventArgs e);

   protected virtual void OnSelectedValueChanged(EventArgs e);

   protected virtual void OnValueMemberChanged(EventArgs 

Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.