There are three types of lists for use within your applications:
ComboBox. These three components all display a list of key value items, and support methods to add, remove, select and manage the items within the list.
This section will list the commonalities within each of the aforementioned components, with the specific behaviors belonging to each outlined in their own sections.
This section describes common functionality amongst all of the list components, and is not itself a class that can be instantiated and used.
Object, and a text
Stringfor display within the component. List components are composed of
- You can construct a
ListItem Objects with the API
The various List classes offer various methods for managing the list of items and maintaining a consistent state between the list and the client.
By using these methods provided in the classes, you can effectively manage the items within the list component. The API allows you to interact with and manipulate the list to meet your application's requirements.
Adding an Item:
- To add an item to the list, you can use the
- You can also add an item by specifying the key and text using the
Inserting an Item at a Specific Index:
- To insert an item at a specific index, use the
- You can insert an item with key and text using the
Inserting Multiple Items: You can insert multiple items at a specified index using thetip
Using the add method triggers a server-to-client message each time it is used. For more efficient usage, create a list of
insert(int index, List<ListItem> items)method outlined below. For more information, you can refer to the documentation on architecture.
Removing an Item:
- To remove an item from the list, use the
- You can also remove all items from the list using
Accessing and Updating Items:
- To access items by key or index, use
- You can update the text of an item using the
Selecting an Item: To select an item within the list, you can use methods such as
Retrieving Information about the List:
- You can get the size of the list using the
- To check if the list is empty, use the
Shared List Properties
The various List components can be assigned a label, which is a descriptive text or title that is associated with the component. It provides a brief explanation or prompt to help users understand the purpose or expected selection for that particular list. List labels are not only important for usability but also play a crucial role in accessibility, as they enable screen readers and assistive technologies to provide accurate information and facilitate keyboard navigation.
All List components share the following events
|An event that is triggered when a component loses focus.
|An event that is triggered when a component gains focus, opposite of a blur event.
|An event that is triggered when the mouse cursor enters the boundaries of a component.
|An event that is triggered when the mouse cursor exits the boundaries of a component.
|An event that is triggered when the user presses the right mouse button while the cursor is over a component.
|An event which is fired when the user selects an item from a list.