(X) Hide this
    • Login
    • Join
      • Generate New Image
        By clicking 'Register' you accept the terms of use .

Tip: Enable multiple selection in Silverlight 3 ListBox

(8 votes)
Nikolay Raychev
>
Nikolay Raychev
Joined Mar 28, 2008
Articles:   22
Comments:   58
More Articles
6 comments   /   posted on Apr 02, 2009
Tags:   selection , listbox , nikolay-raychev
Categories:   Controls
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.

That's it!


Subscribe

Comments

  • -_-

    RE: Enable multiple selection in Silverlight ListBox


    posted by Ola Karlsson on Jun 29, 2009 06:01
    Hi there,

    Any chance you could rename this to "Enable multiple selection in Silverlight 3 ListBox".

    I was searching for Silverlight listbox info anf got this from Google. As using Silverlight 3, at this point in time isn't an option from me, this was less than useful...

    Thanks
  • -_-

    RE: Enable multiple selection in Silverlight 3 ListBox


    posted by Girish on 08:50
    How to do multiple Selection in Silverlight 3 Treeview
  • Ans1210

    RE: Enable multiple selection in Silverlight 3 ListBox


    posted by Ans1210 on Sep 17, 2010 13:43
    It's the very information which I'm looking for. Thank you for detailed description.
  • -_-

    Disable multiple selection in Silverlight 4 Columnseries chart


    posted by Parthesh Mehta on Oct 25, 2010 16:23

    I m use silverlight 4.0

    I have made stacked chart. can u suggest me how i disable multiple selection in column series chart.

  • AneeshSqube

    Re: Tip: Enable multiple selection in Silverlight 3 ListBox


    posted by AneeshSqube on Oct 13, 2011 15:41

    Hello,

          I have i listbox in my project in silverlight 4.I am new in silverlight.Now i have a requirement that i want to make a listbox with two columns and i have to bind some names in first column and a checkbox in second column,for example i have a list of students and from this listbox i want to get the names of students who want to pay fees(just examples),so i want to check more than one checkbox and after that when i save it i want to get all the students names who's checkbox is checked,Hope you get me,pls help me on this. 

  • weitzhandler

    Re: Tip: Enable multiple selection in Silverlight 3 ListBox


    posted by weitzhandler on Apr 05, 2012 09:44

    Is there a SelectedItems property or so?

Add Comment

Login to comment:
  *      *