Docs / UI

Glossary: ListBoxItem

The properties, methods and events of ListBoxItem, in alphabetical order.

Color legend plain property dependency property method

A row of a list box. The list makes the rows for texts, elements and source objects; you can also make a ListBoxItem yourself and add it, to keep the row element. The list only detaches such a row when it is removed or scrolls out of view in Fixed mode, and never disposes it. In a Fixed mode list it is ItemHeight high and gets its own height back when it leaves the list. A row added with IsSelected set joins the selection.

ListBoxItem derives from BaseElement and has its members too. The lists and menus page shows it in context, with code and screenshots.

Names are colored by what they are: a plain property, a method, an event or a dependency property, which a style, a binding or an animation can set.

Properties

Content 🠆

BaseElement · Read-only. The element the row shows.

ContentHeight 🠆

int · Read-only. The row’s height, in units: its content’s, or its own desired height (ItemHeight in a Fixed mode list).

ContentWidth 🠆

int · Read-only. The natural width of the content, in units (the row itself is stretched to the list’s width).

Index 🠆

int · Read-only. The row’s index in the list.

IsSelected 🠆

bool · Whether the row is selected. Setting it on a row in a list selects it as SelectAt does, or deselects it as DeselectAt does. A separator row is never selected.

MouseCursorsSet 🠆

MouseCursorsSet · Read-only. The mouse cursors of the list the row is in.

Source 🠆

object · Read-only. The ItemsSource object the row shows, null for a row added as an element or text.

Methods

ListBoxItem() 🠆

ListBoxItem(BaseElement content, ListBox parentListBox, string name = null) · Creates a row showing the content. parentListBox gives the row its colors until it is in a list; from then on the list it is in counts.

Parameter Type Description
content BaseElement The element the row shows.
parentListBox ListBox The list box whose colors the row has until it is in a list.
name string The element’s Name, which GetElementByName finds it by. Default: null.