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, IBaseObjectWithAttr, IBaseObjectWithId, INotifyPropertyChanged, 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.

Fields

DefaultBorderStyle

Specifies the default border style for controls. By default, it equals Theme.

DefaultHorizontalScrollBarLargeIncrement

Defines the default increment for horizontal scrollbar position. Value is specified in characters. Default is 4.

DefaultUseInternalScrollBars

Indicates whether the list box controls use internal scrollbars.

Properties

BorderStyle

Gets or sets border style of the control.

ContextMenu

Alias for ContextMenuStrip property.

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(BaseCollection<ListControlItem>, 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.

HasHorizontalScrollBarSettings

Indicates whether horizontal scrollbar settings are defined.

HasOwnInterior

Gets a value indicating whether the control has internal scroll bars.

HasVerticalScrollBarSettings

Indicates whether vertical scrollbar settings are defined.

HorizontalExtent

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

HorizontalScrollBarSettings

Gets the horizontal scrollbar settings. Initializes them if required.

IsPartialRowVisible

Gets or sets a value indicating whether partially visible rows are painted.

ScrollOffsetX

Gets the horizontal scroll offset.

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.

VerticalScrollBarSettings

Gets the vertical scrollbar settings. Initializes them if required.

VisibleCount

Gets number of visible items.

Methods

CalcScrollBarInfo(out ScrollBarInfo, out ScrollBarInfo)

Calculates the position information for the scrollbars based on the number of visible items and their total height and maximal width.

CountChanged()

Responds to changes in the item count by updating the scrollbars and invalidating the control.

DefaultPaint(PaintEventArgs)

Default painting method of the UserControl and its descendants.

DoActionScrollCharLeft()

Scrolls the control horizontally by one char to the left.

DoActionScrollCharRight()

Scrolls the control horizontally by one char to the right.

DoActionScrollLineDown()

Scrolls the control down by one line.

DoActionScrollLineUp()

Scrolls the control up by one line.

DoActionScrollPageDown()

Scrolls the control down by one page.

DoActionScrollPageLeft()

Scrolls the control horizontally by one page to the left.

DoActionScrollPageRight()

Scrolls the control horizontally by one page to the right.

DoActionScrollPageUp()

Scrolls the control up by one page.

DoActionScrollToFirstChar()

Scrolls the control horizontally to the first char.

DoActionScrollToFirstLine()

Scrolls to the first line in the control.

DoActionScrollToLastLine()

Scrolls to the last line in the control.

DoHandleItemClick(int, ItemClickFlags)

Handles the logic for item selection when an item is clicked.

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.

GetCharWidth()

Retrieves the width of a single character using the font returned by GetItemFont(int).

GetIndexOnNextPage(int?)

Gets the index of the first item on the next page relative to the specified index.

GetIndexOnPreviousPage(int?)

Gets the index of the first item on the previous page relative to the specified index.

GetItemRect(int?)

Gets the rectangle that represents the bounds of the item at the specified index.

GetPaintRectangle()

Gets the rectangle that represents the paintable area of the control.

GetRenderedItemCount()

Gets the number of items currently rendered in the control.

GetScrollBarInfo(bool)

Gets vertical or horizontal scrollbar position as ScrollBarInfo.

GetVisibleBegin()

Gets index of the first visible item.

GetVisibleEnd()

Determines the index of the last visible item in the control.

GetVisibleEnd(out double, out double)

Determines the index of the last visible item in the control and calculates the total height and maximal width of visible items.

HitTest(PointD)

Returns the zero-based index of the item at the specified coordinates.

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 on the value specified in characters.

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 control's handle is created.

OnKeyDown(KeyEventArgs)

Called when the KeyDown event is raised.

OnLostFocus(EventArgs)

This method is invoked when the control lost focus.

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.

OnMouseWheel(MouseEventArgs)

Called when the MouseWheel event is raised.

OnScroll(ScrollEventArgs)

Called when Scroll event is raised.

OnSizeChanged(EventArgs)

Called when the SizeChanged event.

OnSystemColorsChanged(EventArgs)

Called when the SystemColorsChanged event is raised.

RaiseDrawItem(DrawItemEventArgs)

Raises DrawItem event and OnDrawItem(DrawItemEventArgs) method.

RaiseMeasureItem(MeasureItemEventArgs)

Raises MeasureItem event and OnMeasureItem(MeasureItemEventArgs) method.

RefreshLastRow()

Refreshes the last row in the control.

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.

RunKeyDown(Key, ModifierKeys)

Simulates the key press event by creating and dispatching a KeyEventArgs.

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.

SelectFirstItemAndScroll()

Selects the first item in the tree view control and scrolls to it.

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.

SetHorizontalOffset(double)

Sets horizontal scroll offset.

SetHorizontalOffsetChars(int)

Sets horizontal scroll offset to the value specified in characters.

SetItemsFast(BaseCollection<ListControlItem>, 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.

SetScrollBarInfo(bool, ScrollBarInfo)

Sets vertical or horizontal scrollbar position as ScrollBarInfo.

ToggleItemCheckState(PointD)

Toggles checked state of the item at the specified coordinates.

ToggleItemCheckState(int)

Changes item CheckState to the next value.

UpdateScrollBars(bool)

Updates the vertical and horizontal scrollbars.

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.