Table of Contents

Class ListControl

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

Provides a common implementation of members for the ListBox and ComboBox classes.

public abstract class ListControl : Control, IBaseObject, IDisposableObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IDisposable, IWin32Window, INotifyDataErrorInfo, IReadOnlyStrings
Inheritance
ListControl
Implements
Derived

Properties

Count

Gets the number of elements contained in the control.

FirstItem

Gets first item in the control or null if there are no items.

this[int]

Gets or sets the element at the specified index.

this[long]

Gets or sets the Items element at the specified index.

this[int?]

Gets the element at the specified index.

Items

Gets the items of the ListControl.

LastItem

Gets last item in the control or null if there are no items.

LastRootItem

Gets last root item in the control or null if there are no items.

Search

Gets or sets string search provider.

SelectedAction

Returns Action associated with the SelectedItem if it is ListControlItem.

SelectedIndex

Gets or sets the zero-based index of the currently selected item in the control.

SelectedIndexAsInt

Gets or sets the zero-based index of the currently selected item in the control. Same as SelectedIndex but is not nullable.

SelectedItem

Gets or sets the currently selected item in the control.

SelectedUniqueId

Returns ObjectUniqueId associated with the SelectedItem if it is ListControlItem.

Methods

Add(object)

Adds an object to the end of the Items collection.

Add(string, Action)

Adds text with action to the end of the Items collection.

Add(string, object?)

Adds text with data to the end of the Items collection.

AddEnumValues(Type, object?)

Adds enum values to Items property of the control.

AddEnumValues<T>()

Adds enum values to Items property of the control.

AddEnumValues<T>(T)

Adds enum values to Items property of the control.

ClearSelected()

Unselects all items in the control.

FindString(string)

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

FindString(string, int?)

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

FindStringEx(string?, int?, bool, bool)

Returns the index of the first item in the control beyond the specified index that contains or equal the specified string.

FindStringExact(string)

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

GetItem(int)

Gets item with the specified index. This methods is called from all other methods that request the item.

GetItemText(int)

Returns the text representation of item with the specified index.

GetItemText(object?)

Returns the text representation of the specified item.

ItemsAsText(IReadOnlyList<int>, string?)

Gets items as string.

RemoveAll()

Removed all items from the control.

RemoveItems(IReadOnlyList<int>)

Removes items from the control.

RequiredItem(int)

Gets ListControlItem item with the specified index. If index of the item is invalid, an exception is thrown.

RequiredItem<T>(int)

Gets item with the specified index. If index of the item is invalid, throws an exception.

SafeItem(int)

Gets ListControlItem item with the specified index. If index of the item is invalid or item is not ListControlItem, returns null.

SafeItem<T>(int)

Gets item with the specified index. If index of the item is invalid, returns null.

SelectFirstItem()

Selects first item in the control.

SelectLastItem()

Selects last item in the control.

SelectedItemAs<T>()

Casts selected item to T type.

SetItem(int, object)

Sets item with the specified index. This methods is called from all other methods that change the item.

SetSelectedIndex(int?)

Sets SelectedIndex. Implemented as method for the convenience.

Events

CustomItemText

Occurs when controls needs to get string representation of the item for the display or other purposes. Called from GetItemText(int).