This is a migrated thread and some comments may be shown as answers.

MultiSelect option in Combo Box

27 Answers 1040 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Varun Mangla
Top achievements
Rank 1
Varun Mangla asked on 09 Oct 2009, 04:49 PM
Hi,

How can I incorporate multi select option in Combo Box?

Thanks,

Varun

27 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 16 Oct 2009, 08:06 AM
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.
0
Varun Mangla
Top achievements
Rank 1
answered on 19 Oct 2009, 03:46 PM
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
0
Varun Mangla
Top achievements
Rank 1
answered on 20 Oct 2009, 02:58 PM
I have figured out the solution to my last question.

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

Regards

Varun
0
Mitch Thraves
Top achievements
Rank 2
answered on 10 Dec 2009, 12:59 AM
Hi

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

Regards

Mitch
0
Daniel Schuessler
Top achievements
Rank 1
answered on 15 Apr 2010, 03:09 PM
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.?


0
Valeri Hristov
Telerik team
answered on 22 Apr 2010, 09:55 AM
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.
0
Wolfgang Kaiser
Top achievements
Rank 1
answered on 27 Apr 2010, 11:05 PM
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.

0
Konstantina
Telerik team
answered on 28 Apr 2010, 01:20 PM
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.
0
Rocky Fernandes
Top achievements
Rank 1
answered on 30 Jun 2010, 12:27 AM
Updating SelectionBoxItemTemplate is renamed to SelectionBoxTemplate works.. Thanks
0
Justin Wilson
Top achievements
Rank 1
answered on 10 Aug 2010, 08:25 PM
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,
0
Konstantina
Telerik team
answered on 11 Aug 2010, 08:04 AM
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
0
Justin Wilson
Top achievements
Rank 1
answered on 11 Aug 2010, 03:29 PM

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>

0
Konstantina
Telerik team
answered on 16 Aug 2010, 04:38 PM
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
0
piyush
Top achievements
Rank 1
answered on 17 Aug 2010, 07:17 AM
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 ?
0
Konstantina
Telerik team
answered on 18 Aug 2010, 04:04 PM
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
0
piyush
Top achievements
Rank 1
answered on 19 Aug 2010, 11:53 AM
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
0
Thiru
Top achievements
Rank 1
answered on 23 Aug 2010, 05:42 PM

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.

0
Trent Jones
Top achievements
Rank 1
answered on 23 Aug 2010, 07:29 PM
We are also facing the exact same issue with the selection.  Please advise.
0
Konstantina
Telerik team
answered on 24 Aug 2010, 09:00 AM
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
0
Kakone
Top achievements
Rank 1
answered on 30 Sep 2010, 10:36 AM

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

0
Biruh MEKONNEN
Top achievements
Rank 1
answered on 22 Dec 2010, 01:49 PM
Hi Kakone,

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

regards,
Biruh.
0
Veda
Top achievements
Rank 1
answered on 01 Jul 2011, 07:55 AM
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?
0
Kevin
Top achievements
Rank 1
answered on 24 Jan 2012, 03:09 PM
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
0
M STOLYAR
Top achievements
Rank 1
answered on 03 Feb 2012, 05:36 AM
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!
0
Rocky Fernandes
Top achievements
Rank 1
answered on 20 Apr 2012, 11:41 PM

myCombo.SelectedIndex = 0;

0
Rocky Fernandes
Top achievements
Rank 1
answered on 20 Apr 2012, 11:43 PM

Seeting selectedIndex to after chnaging the item source also works

e,g:
SwimlanesComboBox.SelectedIndex = 0 also works

0
Muhammad
Top achievements
Rank 1
answered on 09 May 2012, 05:11 PM
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
Tags
ComboBox
Asked by
Varun Mangla
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Varun Mangla
Top achievements
Rank 1
Mitch Thraves
Top achievements
Rank 2
Daniel Schuessler
Top achievements
Rank 1
Wolfgang Kaiser
Top achievements
Rank 1
Konstantina
Telerik team
Rocky Fernandes
Top achievements
Rank 1
Justin Wilson
Top achievements
Rank 1
piyush
Top achievements
Rank 1
Thiru
Top achievements
Rank 1
Trent Jones
Top achievements
Rank 1
Kakone
Top achievements
Rank 1
Biruh MEKONNEN
Top achievements
Rank 1
Veda
Top achievements
Rank 1
Kevin
Top achievements
Rank 1
M STOLYAR
Top achievements
Rank 1
Muhammad
Top achievements
Rank 1
Share this question
or