#1,008 – ComboBox Basics

The ComboBox control is similar to the ListBox, in that the user can select an item from a list of items.  While the ListBox displays a subset of its items and allows the user to scroll through them, the ComboBox only displays a currently selected item.  The user can click on the control, causing it to expand, to see a list containing a subset of the items.  They can then scroll through that list to pick an item.

The other big difference between the two controls is that the ComboBox allows selecting no more than a single item.

Below, both the ListBox and ComboBox are bound to a list of actors by setting the control’s ItemSource property.

        <ListBox ItemsSource="{Binding ActorList}" Margin="10"/>

        <ComboBox Grid.Row="1" ItemsSource="{Binding ActorList}" Margin="10"/>

1008-001

Advertisements