#959 – ListBox Basics

You can use a ListBox control to allow a user to select one or more items from a larger list of items.  The ListBox displays some subset of the items, with additional items visible by using scrollbars.

959-001

 

You typically populate a ListBox using data binding, setting its ItemsSource property.  Optionally, you can use the DisplayMemberPath property to indicate which property on the bound items is to be used in generating the text within the ListBox.

The Items property of the ListBox contains a collection of the items displayed in the list.  You typically use the SelectedItemSelectedItems, or SelectedIndex properties to access one or more items that a user has selected.

Instead of simple strings, each item in the ListBox can instead be displayed as a more complex user interface element.

959-002

Advertisement