Table of Contents

Class VirtualListBox

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

Advanced list box control with ability to customize item painting. This control enables you to display a list of items to the user that the user can select by clicking. Works fine with large number of the items. You can add ListControlItem items to this control.

public class VirtualListBox : VirtualListControl, IBaseObjectWithId, IDisposableObject, IBaseObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, INotifyDataErrorInfo, IReadOnlyStrings, IListControlItemContainer, IListControlItemDefaults, ICheckListBox<ListControlItem>, ICustomListBox<ListControlItem>, IListControl<ListControlItem>, IListControl, IControl, IDisposable, IWin32Window
Inheritance
VirtualListBox
Implements
Derived

Remarks

This control can provide single or multiple selections using the SelectionMode property. The BeginUpdate() and EndUpdate() methods enable you to add a large number of items without the control being repainted each time an item is added to the list. The Items, SelectedItems and SelectedIndices properties provide access to the three collections that are used by the control.

Constructors

VirtualListBox()

Initializes a new instance of the VirtualListBox class.

VirtualListBox(Control)

Initializes a new instance of the VirtualListBox class.

Properties

Count

Gets the number of elements contained in the control.

DefaultSetItemsKind

Gets or sets the way how items are set when Default is specified in SetItemsFast(VirtualListBoxItems, SetItemsKind). Default is ChangeField.

DrawMode

Gets or sets the drawing mode for the control.

HasBorder

Gets or sets a value indicating whether the control has a border.

HorizontalExtent

Gets or sets the width by which the horizontal scroll bar can scroll.

TopIndex

Gets or sets the index of the first visible item in the control.

UserPaint

Gets or set a value indicating whether the control paints itself rather than the operating system doing so.

VisibleCount

Gets number of visible items.

Methods

CreateHandler()

Creates a handler for the control.

EditItemsWithListEditor()

Shows list editor dialog which allows to edit items.

EndUpdate()

Resumes painting the control after painting is suspended by the BeginUpdate() method.

EnsureVisible(int)

Makes item with the specified index visible in the control's view.

FindAndSelect(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.

FindFirstVisibleFromLast(int, bool)

Finds first visible item from the specified last visible item.

FindItemWithValue(object?)

Finds the item with Value property which is equal to the specified value.

GetItemRect(int?)

Returns the rectangle occupied by this item in physical coordinates (dips). If the item is not currently visible, returns an empty rectangle.

GetVisibleBegin()

Gets index of the first visible item.

GetVisibleEnd()

Gets index of the last visible item.

HitTestCheckBox(PointD)

Returns the zero-based index of the item, if specified coordinates are over checkbox; otherwise returns null.

IncHorizontalOffset(double)

Increments horizontal scroll offset.

IncHorizontalOffsetChars(int)

Increments horizontal scroll offset.

IsItemVisible(int)

Gets whether item with the specified index is visible.

ItemsCollectionChanged(object?, NotifyCollectionChangedEventArgs)

Callback which is called when items are changed in the control.

MeasureItemSize(MeasureItemEventArgs)

Measures item size. If ItemPainter is assigned, uses GetSize(object, int), otherwise calls DefaultMeasureItemSize(IListControlItemContainer, Graphics, int). Additionally calls MeasureItem event and OnMeasureItem(MeasureItemEventArgs) method if drawing mode is not Normal.

OnDrawItem(DrawItemEventArgs)

Called when DrawItem event is raised.

OnGotFocus(EventArgs)

This method is invoked when the control gets focus.

OnHandleCreated(EventArgs)

Called when the conrol's handle is created.

OnKeyDown(KeyEventArgs)

Called when the KeyDown event is raised.

OnMeasureItem(MeasureItemEventArgs)

Called when the MeasureItem event is raised.

OnMouseDoubleClick(MouseEventArgs)

Called when the mouse button was double-clicked.

OnMouseLeftButtonDown(MouseEventArgs)

Called when the left mouse button was pressed.

OnMouseMove(MouseEventArgs)

Called when the mouse is moved.

OnPaint(PaintEventArgs)

Called when the control is redrawn. See Paint for details.

OnScroll(ScrollEventArgs)

Called when Scroll event is raised.

RaiseDrawItem(DrawItemEventArgs)

Raises DrawItem event and OnDrawItem(DrawItemEventArgs) method.

RaiseMeasureItem(MeasureItemEventArgs)

Raises MeasureItem event and OnMeasureItem(MeasureItemEventArgs) method.

RefreshRow(int)

Triggers a refresh for just the given row's area of the control if it is visible.

RefreshRows(int, int)

Triggers a refresh for the area between the specified range of rows given (inclusively).

RemoveAll()

Removed all items from the control.

RemoveSelectedAndUpdateSelection()

Removes selected items and updates selection so the closest item to the previous selection will become selected.

ScrollRowPages(int)

Scroll by the specified number of pages which may be positive (to scroll down) or negative (to scroll up).

ScrollRows(int)

Scroll by the specified number of rows which may be positive (to scroll down) or negative (to scroll up).

ScrollToFirstRow()

Scrolls control to the first row.

ScrollToLastRow()

Scrolls control to the last row.

ScrollToRow(int)

Scrolls to the specified row.

SelectItemOnNextPage()

Selects item on the next page.

SelectItemOnPreviousPage()

Selects item on the previous page.

SelectItemsAndScroll(params int[])

Selects items with the specified indexes and scrolls the control so the first selected item will become visible in the view.

SelectLastItemAndScroll()

Selects last item in the control and scrolls the control so last item will be visible.

SelectNextItem()

Selects next item.

SelectPreviousItem()

Selects previous item.

SetItemsFast(VirtualListBoxItems, SetItemsKind)

Sets items to the new value using the specified method.

SetItemsFast<TItemFrom>(IEnumerable<TItemFrom>, Action<ListControlItem, TItemFrom>)

Sets items from the specified collection to the control's items as fast as possible.

ToggleItemCheckState(PointD)

Toggles checked state of the item at the specified coordinates.

ToggleItemCheckState(int)

Changes item CheckState to the next value.

Events

DrawItem

Occurs when a visual aspect of an owner-drawn control is changed.

MeasureItem

Occurs when the sizes of the list items are determined.