List Controls
List, ListBoxItem, ListItem and ComboBoxItem
List controls present selectable rows. The Dropdown and DataGrid pages cover those controls; this page documents the list primitives.
On this page
List
Scrollable list of items.
List
A Material Design 3.0 List component with support for single-line, two-line, and three-line items.
| Member | Kind | Description |
|---|---|---|
event EventHandler<ListItem> ItemSelected | Event | Occurs when an item is selected. |
event EventHandler<ListItem> ItemClicked | Event | Occurs when an item is clicked. |
ObservableCollection<ListItem> Items | Property | Gets or sets the collection of list items. |
ListItem SelectedItem | Property | Gets or sets the currently selected item (for single selection mode). |
ListType Type | Property | Gets or sets the list type (single-line, two-line, or three-line). |
bool ShowDividers | Property | Gets or sets whether to show dividers between items. |
bool AllowSelection | Property | Gets or sets whether items can be selected. |
SelectionMode Mode | Property | Gets or sets the selection mode. |
float ItemHeight | Property | Gets or sets the height of each list item. |
float DividerThickness | Property | Gets or sets the thickness of dividers. |
SKColor DividerColor | Property | Gets or sets the color of dividers. |
float FontSize | Property | Gets or sets the font size for list items. |
List() | Method | Initializes a new instance of the List class. |
void AddItem(string primaryText, string secondaryText = null, string tertiaryText = null, string leadingIcon = null, string trailingIcon = null, object tag = null) | Method | Adds an item to the list. |
void AddItem(ListItem item) | Method | Adds a ListItem to the list. |
void RemoveItem(ListItem item) | Method | Removes an item from the list. |
void ClearItems() | Method | Clears all items from the list. |
void SelectItem(ListItem item) | Method | Selects an item in the list. |
List Items
Row primitives used by lists, dropdowns and combo boxes.
ListBoxItem
Represents an item in a list box.
| Member | Kind | Description |
|---|---|---|
string Text | Property | Gets or sets the text of the item. |
object Value | Property | Gets or sets the value associated with the item. |
bool Selected | Property | Gets or sets whether the item is selected. |
ListBoxItem() | Method | Initializes a new instance of the ListBoxItem class. |
ListBoxItem(string text) | Method | Initializes a new instance of the ListBoxItem class with the specified text. |
ListBoxItem(string text, object value) | Method | Initializes a new instance of the ListBoxItem class with the specified text and value. |
override string ToString() | Method | Returns a string representation of the item. |
ListItem
Represents an item in a list component
| Member | Kind | Description |
|---|---|---|
string Text | Property | Gets or sets the item text |
string SubText | Property | Gets or sets the item sub-text |
string Icon | Property | Gets or sets the icon name or path |
SKColor TextColor | Property | Gets or sets the text color |
SKColor SubTextColor | Property | Gets or sets the sub-text color |
SKColor IconColor | Property | Gets or sets the icon color |
SKColor BackgroundColor | Property | Gets or sets the background color |
SKColor SelectedBackgroundColor | Property | Gets or sets the selected background color |
SKColor HoverBackgroundColor | Property | Gets or sets the hover background color |
float Height | Property | Gets or sets the item height |
bool IsVisible | Property | Gets or sets whether the item is visible |
bool IsEnabled | Property | Gets or sets whether the item is enabled |
bool IsSelected | Property | Gets or sets whether the item is selected |
object Tag | Property | Gets or sets the tag object |
bool IsHovered | Property | Gets whether the item is currently hovered |
bool IsPressed | Property | Gets whether the item is currently pressed |
List ParentList | Property | Gets the parent List |
event EventHandler Click | Event | Occurs when the item is clicked |
ListItem() | Method | Initializes a new instance of the ListItem class |
ListItem(string text) | Method | Initializes a new instance of the ListItem class with text |
ListItem(string text, string subText) | Method | Initializes a new instance of the ListItem class with text and sub-text |
virtual void PerformClick() | Method | Raises the Click event |
ComboBoxItem
Represents an item in a combo box.
| Member | Kind | Description |
|---|---|---|
string Text | Property | Gets or sets the text of the item. |
object Value | Property | Gets or sets the value associated with the item. |
bool Enabled | Property | Gets or sets whether the item is enabled. |
ComboBoxItem() | Method | Initializes a new instance of the ComboBoxItem class. |
ComboBoxItem(string text) | Method | Initializes a new instance of the ComboBoxItem class with the specified text. |
ComboBoxItem(string text, object value) | Method | Initializes a new instance of the ComboBoxItem class with the specified text and value. |
override string ToString() | Method | Returns a string representation of the item. |