This documentation is archived and is not being maintained.

How to: Use ListBox Selection Modes

.NET Framework 3.0

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).


<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>

For the complete sample, see List Box Sample.

See Also