In
Silverlight 3 you can make multiple selections in a
ListBox. You just need to set the
SelectionMode parameter:
<ListBox Margin="5" x:Name="lbTasks" |
ItemsSource="{Binding Tasks, ElementName=MainPageView}" |
SelectionMode="Multiple"> |
<ListBox.ItemTemplate> |
<DataTemplate> |
<StackPanel Orientation="Horizontal" Margin="2"> |
<TextBlock FontWeight="Bold" FontSize="13" |
Foreground="#ff006882" Text="{Binding Text}"> |
</TextBlock> |
</StackPanel> |
</DataTemplate> |
</ListBox.ItemTemplate> |
</ListBox> |
You have 3 options for the SelectionMode:
- Single - you can select only one item.
- Multiple - you can select multiple items by selecting one item, holding Ctrl or Shift key and pressing another item.
- Extended - you can again select multiple items but the Shift key acts differently. With the help of the Shift key you can select items range by just pressing one item, holding Shift and pressing another one.