List Box - Overview

The List Box component allows users to select items from a list of predefined strings. The component can be bound to any IEnumerable data source. The list of selected items can be accessed and/or specified via the Values property. To track selection changes, use the SelectedItemsChanged event or the two-way synchronization as demonstrated in this module.

In this demo, the component allows users to select only one item at a time. Select an item to see the corresponding object's property values.

List Box - Multiple ColumnsNew

The List Box can display data across multiple columns. To create columns, use DxListEditorColumn objects that include the following options for column customization:

  • Caption - Specifies the column caption.
  • FieldName - Specifies the data source field that populates column items.
  • Visible - Specifies the column visibility.
  • VisibleIndex - Specifies the column display order.
  • Width - Specifies the column width.
Selected item: John Heart (Electronics Dept.)
Id
Name
Surname
0 John Heart
1 Samantha Bright
2 Arthur Miller
3 Robert Reagan
4 Greta Sims
5 Brett Wade
6 Sandra Johnson
7 Edward Holmes
8 Barbara Banks
9 Kevin Carter
10 Cynthia Stanwick
11 Sam Hill

List Box - Multiple Selection

To enable multiple selection in the List Box, set the SelectionMode property to ListBoxSelectionMode.Multiple.

  • If the ShowCheckboxes option is enabled, users can click individual items and corresponding checkboxes or hold Shift to select a range of items.
  • If the ShowCheckboxes option is disabled, users can press Ctrl to select individual items or hold Shift to select a range of items.

  • John Heart (Electronics Dept.)
  • Samantha Bright (Motors Dept.)
  • Arthur Miller (Software Dept.)
  • Robert Reagan (Electronics Dept.)
  • Greta Sims (Motors Dept.)
  • Brett Wade (Software Dept.)
  • Sandra Johnson (Electronics Dept.)
  • Edward Holmes (Motors Dept.)
  • Barbara Banks (Software Dept.)
  • Kevin Carter (Electronics Dept.)
  • Cynthia Stanwick (Motors Dept.)
  • Sam Hill (Electronics Dept.)
Selected items:
  • John Heart (Electronics Dept.)
  • Samantha Bright (Motors Dept.)

List Box - Item ValuesNew

The List Box component provides access to item values. The value is assigned to the editor's value when a user selects an item from the list. To enable this access, set the ValueFieldName property to the name of the data source field that ships with values for the List Box items.

If the ValueFieldName property is not specified, the List Box component searches for a Value field in the data source and uses this field as a value field. Otherwise, values are not assigned to editor items.

To access values of the selected items, use the Values property. To track selection changes, use the ValuesChanged event or two-way synchronization as demonstrated in this module.

List Box - Virtual Scrolling

The ListRenderMode property specifies how the List Box loads the item list.

  • Entire - The List Box loads the entire item list. Use this option for small item lists where scrolling should be instantly.
  • Virtual - The List Box loads visible items only. This approach improves performance when the list contains many items.

In this demo, the ListRenderMode property is set to ListRenderMode.Virtual.

List Box - Read-Only Mode

The List Box component allows you to display selected items, but does not allow users to change the selection. Set the ReadOnly property to true to activate the read-only mode.