How can I incorporate multi select option in Combo Box?
Thanks,
Varun
27 Answers, 1 is accepted
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.
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
Thank you very much. The application you sent was of great help.
Regards
Varun
Do you have an example of your checkablecombobox.zip also available in vb.net? (WPF if possible!)
Regards
Mitch
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.
The attribute RadComboBox.SelectionBoxItemTemplate is read only and cannot be set. [Line: 30 Position: 19]
just before getting a runtime error.
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.
Thanks,
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
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>
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
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 ?
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
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
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.
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
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
I've added my basic solution with a select all feature on your thread.
I hope you don't mind.
regards,
Biruh.
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?
How can I bind the text value of the combobox for every item I check an item to a property within my viewmodel?
Kevin
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
>
<
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!
myCombo.SelectedIndex = 0;
Seeting selectedIndex to after chnaging the item source also works
e,g:
SwimlanesComboBox.SelectedIndex = 0 also works
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