How to: Use ListBox Selection Modes

This example shows how to set the selection modes for ListBox. The SelectionMode property indicates how many ListBoxItem elements a user can select at one time. You can set this property to Single (the default value), Multiple, or Extended. The following example shows how to create a ListBox where users can select more than one item (Multiple selections).

Example

<ListBox Width="265" Height="55" HorizontalAlignment="Left" SelectionMode="Multiple">
      <DockPanel><Image Source="data\cat.png"/><TextBlock>CAT</TextBlock></DockPanel>
      <DockPanel><Image Source="data\dog.png"/><TextBlock>DOG</TextBlock></DockPanel>
      <DockPanel><Image Source="data\fish.png"/><TextBlock>FISH</TextBlock></DockPanel>
</ListBox>

For the complete sample, see List Box Sample.

See Also

Tasks

How to: Create a ListBox with an Event Handler

Concepts

ListBox Overview