MultiSelect option in Combo Box

28 posts, 0 answers
  1. Varun Mangla
    Varun Mangla avatar
    4 posts
    Member since:
    Oct 2009

    Posted 09 Oct 2009 Link to this post

    Hi,

    How can I incorporate multi select option in Combo Box?

    Thanks,

    Varun
  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 16 Oct 2009 Link to this post

    Hello Varun,

    RadComboBox for Silverlight (and WPF) does not support multiple selection out of the box. Find attached a simple example that demonstrates one of the simplest ways to implement it.

    Regards,
    Valeri Hristov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. Varun Mangla
    Varun Mangla avatar
    4 posts
    Member since:
    Oct 2009

    Posted 19 Oct 2009 Link to this post

    Hello Valeri Hristov,

    Thanks for the application you sent me.

    There's one more facility I want to have in MultiSelect Combo Box. If the user clicks the first option all other options get clicked automatically.

    I have been struggling with that too. How can I do it?

    Thanks a lot for help.

    Varun
  5. Varun Mangla
    Varun Mangla avatar
    4 posts
    Member since:
    Oct 2009

    Posted 20 Oct 2009 Link to this post

    I have figured out the solution to my last question.

    Thank you very much. The application you sent was of great help.

    Regards

    Varun
  6. Mitch Thraves
    Mitch Thraves avatar
    20 posts
    Member since:
    Feb 2006

    Posted 09 Dec 2009 Link to this post

    Hi

    Do you have an example of your checkablecombobox.zip also available in vb.net? (WPF if possible!)

    Regards

    Mitch
  7. Daniel Schuessler
    Daniel Schuessler avatar
    7 posts
    Member since:
    Mar 2010

    Posted 15 Apr 2010 Link to this post

    I've implemented your solution and it works very well except for one thing; the only time that using the spacebar to check off a selection works is if the user mouse selects the item first.  Also keyboard navigation tends to skip selected items.  Is there a way to ensure that if the user uses the keyboard that they can press the spacebar (normal checkbox behaviour) to toggle the checkmark of a selection.?


  8. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 22 Apr 2010 Link to this post

    Hello Daniel,

    You could try setting IsTextSearchEnabled=false on RadComboBox - this will prevent the control from handling the KeyDown event when Space is pressed.

    All the best,
    Valeri Hristov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  9. Wolfgang Kaiser
    Wolfgang Kaiser avatar
    9 posts
    Member since:
    Dec 2009

    Posted 27 Apr 2010 Link to this post

    I tried the example using 2010 Q1 and get this error:

    The attribute RadComboBox.SelectionBoxItemTemplate is read only and cannot be set. [Line: 30 Position: 19]
    just before getting a runtime error.

  10. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 28 Apr 2010 Link to this post

    Hello Wolfgang,

    Since Q1 2010 version of the controls the property SelectionBoxItemTemplate is renamed to SelectionBoxTemplate. Please rename it in the project and the error will disappear.

    If you have any other questions let us know.

    Kind regards,
    Konstantina
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  11. Rocky Fernandes
    Rocky Fernandes avatar
    12 posts
    Member since:
    Jul 2009

    Posted 29 Jun 2010 Link to this post

    Updating SelectionBoxItemTemplate is renamed to SelectionBoxTemplate works.. Thanks
  12. Justin Wilson
    Justin Wilson avatar
    18 posts
    Member since:
    Jun 2010

    Posted 10 Aug 2010 Link to this post

    Do you think there is any way to use the autocomplete functionality with this modified combo box?  I can't seem to get it to work.  I have a very long list and they need the ability to select multiple items.  I don't want them to have to scroll through the whole list to find something.  Any ideas would be helpful.

    Thanks,
  13. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 11 Aug 2010 Link to this post

    Hi Justin Wilson,

    Thank you for your question.

    For more information about autocomplete option you can refer to this help article.
    What difficulties do you experience with the ComboBox? Could you please send us some sample code of your ComboBox?

    Looking forward to your reply.

    Sincerely yours,
    Konstantina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  14. Justin Wilson
    Justin Wilson avatar
    18 posts
    Member since:
    Jun 2010

    Posted 11 Aug 2010 Link to this post

    I am using the code sample you provided above.  I have just been playing with the combo box properties and seeing what i can do.  If I use the control just as you have it I have not problem.  I have a couple of issues. 

    1.  It only accepts an object of type DataItem.  I am looking to create a generic control I can reuse with different objects in different pages.

    2.  When I set IsEditable to True and IsTextSearchEnabled to True the autocomplete doesn't really work.  I understand why it wouldn't but I was wondering if you have any other suggestions or ideas.

    Ultimately my problem is I have a couple places that need a clean interface to search a large list and select multiple options.  The ComboBox is very close to what I need.  If I didn't need to multiselect it would be perfect.  The MultiCombo box you provided is also close.  It can do the multil selection but only takes one type (DataItem) and eliminates some of the other features of the Telerik Combo box.  Let me know what you think.  Thanks for all your help.

    FYI I am using SilverLight 4 in VS 2010 and Telerik Q1 2010 SP2.

    <telerikInput:RadComboBox VerticalAlignment="Top" Width="200" IsEditable="True" CanAutocompleteSelectItems="True"
        ItemsSource="{Binding DataItems, Source={StaticResource DataViewModel}}" IsTextSearchEnabled="True">

       <telerikInput:RadComboBox.ItemTemplate>
        <DataTemplate>
         <CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}" Content="{Binding Text}" />
        </DataTemplate>
       </telerikInput:RadComboBox.ItemTemplate>

       <telerikInput:RadComboBox.SelectionBoxTemplate>
        <DataTemplate>
         <TextBlock
           Text="{Binding Owner.CheckedItems, Converter={StaticResource ValueConverter}}" />
        </DataTemplate>
       </telerikInput:RadComboBox.SelectionBoxTemplate>

      </telerikInput:RadComboBox>

  15. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 16 Aug 2010 Link to this post

    Hi Justin,

    Thank you for your question.

    You can use every object for an Item of the ComboBox, the DataItem is just for example. You can create Checkable interface, which will inherit INotifyPropertyChanged interface. This new interface should have IsChecked property. The collection of the Items should implement this ICheckable interface. When you set the TextSearch.TextPath property of the ComboBox the Autocomplete will be enabled.
    Please find attached a sample project which illustrates the above mentioned approach.

    If you need further help please let us know.

    Regards,
    Konstantina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  16. piyush
    piyush avatar
    8 posts
    Member since:
    Jun 2010

    Posted 17 Aug 2010 Link to this post

    Hi

    I am using above code to show checkable combobox. But it seems like this code is not working when we change the itemsource of combobox. Actually when I change the itemsource of combobox  SelectionBoxTemplate is not showing any text when any checkbox is checked. However instead of clicking checkbox if I click on empty area in an item(i.e.  the white area after checkbox text ) and then check/uncheck checkbox ,everything works fine. Can anybody help me in this ?
  17. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 18 Aug 2010 Link to this post

    Hello piyush,

    There shouldn't be any problems with the solution when changing the ItemsSource. Could you please send us your project. In that way we will be able to track down the source of the issue and provide you with solution.

    Looking forward to your reply.

    All the best,
    Konstantina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  18. piyush
    piyush avatar
    8 posts
    Member since:
    Jun 2010

    Posted 19 Aug 2010 Link to this post

    Hey

    In your solution just change the datasource of checkable combobox twice. For example open your solution and add a button or dropdown and add a click handler for that . In the handler change the itemsource of checkable combobox and then see whether results are expected. I used ur solution and did this thing. After change itemsource things are not working as expected
  19. Thiru
    Thiru avatar
    1 posts
    Member since:
    Aug 2010

    Posted 23 Aug 2010 Link to this post

    SelectionBoxTemplate is binding data very first time when the control is loading, for next time when property changes or selection is changes this template is not binding the selected data in box.

  20. Trent Jones
    Trent Jones avatar
    49 posts
    Member since:
    Aug 2009

    Posted 23 Aug 2010 Link to this post

    We are also facing the exact same issue with the selection.  Please advise.
  21. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 24 Aug 2010 Link to this post

    Hi guys,

    Straight to the question:

    To make it work you will have to set the SelectedItem property of the RadComboBox. In that way the SelectionBoxTemplate will apply and it will work correctly. Every time the ItemsSource is changed the SelectedItem have to be set.

    Hope this helps. If you need further help please let us know.

    Regards,
    Konstantina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  22. Kakone
    Kakone avatar
    65 posts
    Member since:
    Jan 2010

    Posted 30 Sep 2010 Link to this post

    Hi,

    If you are interested, I did my own MultiSelect combobox with SelectedItems and SelectedValues properties directly on the ComboBox, you can test it here :
    http://www.telerik.com/community/code-library/silverlight/general/a-multiselect-combobox.aspx

    Cordially,
    Kakone

  23. Biruh MEKONNEN
    Biruh MEKONNEN avatar
    23 posts
    Member since:
    Apr 2010

    Posted 22 Dec 2010 Link to this post

    Hi Kakone,

    I've added my basic solution with a select all feature on your thread.
    I hope you don't mind.

    regards,
    Biruh.
  24. Veda
    Veda avatar
    18 posts
    Member since:
    May 2011

    Posted 01 Jul 2011 Link to this post

    Hi,
    Below is the code i have written for multiple selection of items in rabcombobox.
      <telerikInput:RadComboBox Height="20" Margin ="3,0,3,0"  Grid.Column="6"  Width="150" ItemsSource="{Binding GensetParameter, Mode=TwoWay}" >
                                    <telerikInput:RadComboBox.ItemTemplate>
                                        <DataTemplate>
                                            <CheckBox ClickMode="Press">
                                                <CheckBox.Content>
                                                    <TextBlock Text="{Binding parameterName, Mode=TwoWay}"/>
                                                </CheckBox.Content>
                                            </CheckBox>
                                        </DataTemplate>
                                    </telerikInput:RadComboBox.ItemTemplate>
                                </telerikInput:RadComboBox>


    Can you please help me how to get the multiple items selected to the viewmodel?
  25. Kevin
    Kevin avatar
    1 posts
    Member since:
    Sep 2011

    Posted 24 Jan 2012 Link to this post

    I'm using this code @ the moment in wpf/MVVM.

    How can I bind the text value of the combobox for every item I check an item to a property within my viewmodel?

    Kevin
  26. M STOLYAR
    M STOLYAR avatar
    12 posts
    Member since:
    Dec 2010

    Posted 02 Feb 2012 Link to this post

    Hello, Telerik Team!

    I have a question about how to better incorporate SelectAll functionality inside RadComboBox.
    I've implemented basic solution when some checkbox outside RadComboBox is binded to IsAllSelected property of DataItems property of ViewModel and I'm trying to implement the same inside RadComboBox, when the first item of popup items is doing select/unselect all.

    When SelectAll checkbox is outside RadComboBox everything is simple:
    <CheckBox Content="(Select All)"
              DataContext="{StaticResource DataViewModel}"
              IsChecked="{Binding DataItems.IsAllSelected, Mode=TwoWay}"
              HorizontalAlignment="Center"/>


    public class CheckableCollection : ObservableCollection<ICheckable> {
        ...
            public bool IsAllSelected {
                get { return this.All(item => item.IsChecked); }
                set {
                    foreach (var item in this)
                        item.IsChecked = value;
                }
            }
    }


    But when I'm trying to implement within RadComboBox I cannot use default item template:
    <DataTemplate x:Key="DataItemCheckBoxTemplate">
        <CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}"
                  Content="{Binding Text}" />
    </DataTemplate>
    because SelectAll checkbox must binded to IsAllSelected property, not IsChecked. But this solvable by ItemTemplateSelector and item template for select all item will be:
    <DataTemplate x:Key="AllOptionCheckBoxTemplate">
        <CheckBox IsChecked="{Binding IsAllSelected, Mode=TwoWay}"
                  Content="{Binding Text}" />
    </DataTemplate>

    I this case I must to explicitly add in data items collection the first "select all" fictionale item with some property which sill allow to distinct it from another data items in ItemTemplateSelector.
    But first problem is that when we binding to IsChecked property we binding to property of data item, but when to IsAllSelected we must bind to property of collection of data items.
    The second problem is this is not looking as a decent approach.
    Maybe you may advise some better one?

    This code is based on "checkablecombo-2.zip" solution from this thread.

    Sorry for my English.
    All the best!
  27. Rocky Fernandes
    Rocky Fernandes avatar
    12 posts
    Member since:
    Jul 2009

    Posted 20 Apr 2012 Link to this post

    myCombo.SelectedIndex = 0;

  28. Rocky Fernandes
    Rocky Fernandes avatar
    12 posts
    Member since:
    Jul 2009

    Posted 20 Apr 2012 Link to this post

    Seeting selectedIndex to after chnaging the item source also works

    e,g:
    SwimlanesComboBox.SelectedIndex = 0 also works

  29. Muhammad
    Muhammad avatar
    24 posts
    Member since:
    Mar 2012

    Posted 09 May 2012 Link to this post

    Hi every one,
    i got a requirement i want to display << Multiple items selected >> when user select more then one item from the multi select combobox and want to display the item if only one item is selected.
    with regards
    shabbir isoft csc
Back to Top
DevCraft banner