Skip to main content
Version: 4.1

ListBox

Namespace: Wisej.Web

Assembly: Wisej.Framework (4.1.0.0)

Represents a control to display a list of items.

public class ListBox : ListControl, ILabel, IReadOnly

Constructors

Instance member ListBox()

Initializes a new instance of ListBox.

Instance member ListBox(onSelectedIndexChanged)

Initializes a new instance of the ListBox class with the specified settings.

NameTypeDescription
onSelectedIndexChangedAction<Object, EventArgs>Optional SelectedIndexChanged handler.

Instance member ListBox(dataSource, displayMember, valueMember, iconMember, onSelectedIndexChanged)

Initializes a new instance of ListBox class with the specified settings.

NameTypeDescription
dataSourceObjectInitial DataSource.
displayMemberStringInitial DisplayMember.
valueMemberStringInitial ValueMember.
iconMemberStringInitial IconMember.
onSelectedIndexChangedAction<Object, EventArgs>Optional SelectedIndexChanged handler.

Instance member ListBox(location, size, onSelectedIndexChanged)

Initializes a new instance of the ListBox class with the specified settings.

NameTypeDescription
locationPointInitial location.
sizeSizeInitial size.
onSelectedIndexChangedAction<Object, EventArgs>Optional SelectedIndexChanged handler.

Instance member ListBox(location, size, dataSource, displayMember, valueMember, iconMember, onSelectedIndexChanged)

Initializes a new instance of the ListBox class with the specified settings.

NameTypeDescription
locationPointInitial location.
sizeSizeInitial size.
dataSourceObjectInitial DataSource.
displayMemberStringInitial DisplayMember.
valueMemberStringInitial ValueMember.
iconMemberStringInitial IconMember.
onSelectedIndexChangedAction<Object, EventArgs>Optional SelectedIndexChanged handler.

Properties

Instance member AllowHtml

Boolean: Returns or sets a value indicating that the control can display HTML in the Text property. (Default: False)

Protected member AllowSelection

Boolean: Returns a value indicating whether the ListBox currently enables selection of list items.

Protected member DefaultSize

Size: Returns the default size for a text box control.

Instance member HorizontalScrollbar

Boolean: Returns or sets whether a horizontal scroll bar is displayed in the control. (Default: False)

Instance member IncrementalSelection

Boolean: Returns or sets whether items are selected incrementally as the user types within a timeout of 1 second. (Default: True)

Instance member ItemHeight

Int32: Gets or sets the height of the list items. When the value is -1, uses the value set in the theme. (Default: -1)

Throws:

Instance member Items

ObjectCollection: Returns the collection of the items contained in this ListBox.

Instance member Label

LabelWrapper: Provides a label related to the control.

Instance member LabelText

String: Returns or sets the localizable label associated with this control. (Default: "")

Instance member LazyLoading

Boolean: Returns or sets whether the items in the list are send to the client when the list becomes visible the first time. (Default: False)

Instance member Orientation

Orientation: Returns or sets whether the list box displays the items vertically (default) or horizontally. Since 3.1 (Default: Vertical)

Throws:

Instance member ReadOnly

Boolean: Returns or sets whether the control is read-only. (Default: False)

Instance member RightClickSelection

Boolean: Returns or sets whether the item under the pointer gets selected on a right click. (Default: False)

When the right click lands outside of a selected area the selection is not changed regardless of the value of RightClickSelection.

Instance member ScrollAlwaysVisible

Boolean: Returns or sets whether the vertical scroll bar is shown at all times. (Default: False)

Instance member SelectedIndex

Int32: Returns or sets the zero-based index of the currently selected item in a ListBox.

Throws:

Instance member SelectedIndices

SelectedIndexCollection: Returns a collection that contains the zero-based indexes of all currently selected items in the ListBox.

Instance member SelectedItem

Object: Returns or sets the currently selected item in the ListBox.

Instance member SelectedItems

SelectedObjectCollection: Returns a collection containing the currently selected items in the ListBox.

Instance member SelectionMode

SelectionMode: Returns or sets the method in which items are selected in the ListBox. (Default: One)

Instance member Sorted

Boolean: Returns or sets whether the items in the combo box are sorted. (Default: False)

Throws:

Instance member Tools

ComponentToolCollection: Returns the instance of ComponentToolCollection associated with this control.

Instance member TopIndex

Int32: Returns or sets the index of the first visible item in the ListBox.

Methods

Instance member BeginUpdate()

Not used. Kept for compatibility.

Instance member ClearSelected()

Unselects all items in the ListBox.

Protected member CreateItemCollection()

Creates a new instance of the item collection.

Returns: ObjectCollection. A ObjectCollection that represents the new item collection.

Protected member Dispose(disposing)

Disposes the control.

ParameterTypeDescription
disposingBooleantrue when this method is called by the application rather than a finalizer.

Instance member EndUpdate()

Not used. Kept for compatibility.

Instance member FindString(text)

Returns the index of the first item in the ListBox that starts with the specified string.

ParameterTypeDescription
textStringThe String to search for.

Returns: Int32. The zero-based index of the first item found; returns -1 if no match is found.

Instance member FindString(text, startIndex)

Returns the index of the first item in the ListBox beyond the specified index that contains the specified string. The search is not case sensitive.

ParameterTypeDescription
textStringThe String to search for.
startIndexInt32The zero-based index of the item before the first item to be searched. Set to -1 to search from the beginning of the control.

Returns: Int32. The zero-based index of the first item found; returns -1 if no match is found, or 0 if the text parameter specifies Empty.

Instance member FindStringExact(text)

Finds the first item in the combo box that matches the specified string.

ParameterTypeDescription
textStringThe String to search for.

Returns: Int32. The zero-based index of the first item found; returns -1 if no match is found, or 0 if the text parameter specifies Empty.

Instance member FindStringExact(text, startIndex)

Finds the first item after the specified index that matches the specified string.

ParameterTypeDescription
textStringThe String to search for.
startIndexInt32The zero-based index of the item before the first item to be searched. Set to -1 to search from the beginning of the control.

Returns: Int32. The zero-based index of the first item found; returns -1 if no match is found, or 0 if the text parameter specifies Empty.

Instance member GetSelected(index)

Returns a value indicating whether the specified item is selected.

ParameterTypeDescription
indexInt32The zero-based index of the item that determines whether it is selected.

Returns: Boolean. true if the specified item is currently selected in the ListBox; otherwise, false.

Throws:

Protected member OnDataSourceChanged(e)

Fires the DataSourceChanged event.

ParameterTypeDescription
eEventArgsA EventArgs that contains the event data.

Protected member OnDisplayMemberChanged(e)

Fires the DisplayMemberChanged event.

ParameterTypeDescription
eEventArgsA EventArgs that contains the event data.

Protected member OnLoad(e)

Fires the Load event.

ParameterTypeDescription
eEventArgsA EventArgs that contains the event data.

Protected member OnReadOnlyChanged(e)

Fires the ReadOnlyChanged event.

ParameterTypeDescription
eEventArgsAn EventArgs that contains the event data.

Protected member OnSelectedIndexChanged(e)

Fires the SelectedIndexChanged event.

ParameterTypeDescription
eEventArgsA EventArgs that contains the event data.

Protected member OnSortedChanged(e)

Fires the SortedChanged event.

ParameterTypeDescription
eEventArgsA EventArgs that contains the event data.

Protected member OnToolClick(e)

Fires the ToolClick event.

ParameterTypeDescription
eToolClickEventArgsA ToolClickEventArgs that contains the event data.

Protected member OnValueMemberChanged(e)

Fires the ValueMemberChanged event.

ParameterTypeDescription
eEventArgsA EventArgs that contains the event data.

Protected member OnWebEvent(e)

Processes the event from the client.

ParameterTypeDescription
eWisejEventArgsEvent arguments.

Protected member OnWebRender(config)

Renders the client component.

ParameterTypeDescription
configObjectDynamic configuration object.

Protected member OnWebUpdate(state)

Updates the client component using the state information.

ParameterTypeDescription
stateObjectDynamic state object.

Protected member RefreshItem(index)

Refreshes the item contained at the specified location.

ParameterTypeDescription
indexInt32The location of the item to refresh.

Protected member RefreshItems()

Reloads all the ListBox items from the data source.

Instance member SelectAll()

Selects all the items in the ListBox.

Protected member SetItemCore(index, value)

Sets the object with the specified index in the derived class.

ParameterTypeDescription
indexInt32The array index of the object.
valueObjectThe object.

Protected member SetItemsCore(value)

Sets the specified array of objects in a collection in the derived class.

ParameterTypeDescription
valueIListAn array of items.

Instance member SetSelected(index, selected)

Selects or clears the selection for the specified item in a ListBox.

ParameterTypeDescription
indexInt32The zero-based index of the item in a ListBox to select or clear the selection for.
selectedBooleantrue to select the specified item; otherwise, false.

Throws:

Protected member Sort()

Sorts the items in the ListBox.

Events

Instance member Load

EventHandler Fired when the LazyLoading property is true and the ListBox is first shown.

When LazyLoading is true An application may fill the items at any time prior to the ListBox being shown, or while processing the Load event.

Instance member ReadOnlyChanged

EventHandler Fired when the value of the ReadOnly property has changed.

Instance member SelectedIndexChanged

EventHandler Fired when the SelectedIndex property or the SelectedIndices collection has changed.

Instance member SortedChanged

EventHandler Fired when the Sorted property has changed.

Instance member ToolClick

ToolClickEventHandler Fired when a ComponentTool is clicked.

Inherited By

NameDescription
CheckedListBoxDisplays a ListBox in which a check box is displayed to the left of each item.

Implements

NameDescription
IUserDataProvides access to the UserData and Tag properties associated to the component implementing this interface.
IBindableComponentBindable components implement this interface.
IDropTargetControls that support drag & drop operations implement this interface.
ILabelProvides access to the LabelWrapper associated with the controls that implement this interface.
IReadOnlyProvides access to the ReadOnly property for coontrols that support the read-only mode.
IModifiedProvides access to the Modified property and ModifiedChanged event for controls that implement this interface.
IValidationProvides access to the validation events and properties property for controls that support validation.
IWisejComponentAll wisej components implement this interface.
IWisejControlAll wisej controls derived from the Control class must implement this interface.
IWisejSerializableAllows an object to serialize itself.