ListBox
From Visual WebGui Wiki
| This article will have a few sections added to it soon, based on the following article type skeleton: NewControlTemplate |
Contents |
Overview
The ListBox control is functionally equivialent to the Windows Forms ListBox control and it displays a list of items to select from.
The list of available items to select from can be built manually through the Items collection, or by using the DataSource property and assigning a DataSource of some kind.
Availability
The ListBox is one of the Out of the Box standard controls, which means it is free and available in all Visual WebGui versions.
Relevant members
Properties
| Name | Description |
|---|---|
| Items | A collection of items to select from . When populating the control manually, you will use this collection to add your items. |
| DataSource | Any list that implements IList or IListSource interfaces. ArrayList being one of the typical lists that can be assigned here. |
| DisplayMember | When using DataSource, then property (field) within the DataSource that should display in the list of available values. |
| ValueMember | When using DataSource, then property (field) within the DataSource that represents the value of the currently selected item. |
| SelectedIndex | The sequential index of the currently selected item within it's source list (manual or DataSource) |
| SeletedItem |
The currently selected item. The type of this property varies, depending on the type of datasource in use. No DataSource ► nothing DataSource is DataTable ►System.Data.DataRowView DataSource is BindingSource ►System.Data.DataRowView DataSource is any other IList or IListSource ►An item from that datasource |
| SelectedValue | The value of the currently selected item. If using the ComboBox without DataSource, then simply the item from the manually populated list. If using DataSource, then the property from the DataSource set in the ValueMember property above (defaults to ToString() if not set). |
Events
| Name | Description |
|---|---|
| SelectedIndexChanged | Fires whenever the item selection is changed.
Note, that for populating by using the DataSource property, this event will fire during the initial population. |
Samples of use
Rererences
Other references
