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

Multi select for the combobox

28 Answers 736 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Rafael Moreno del Pino
Top achievements
Rank 1
Rafael Moreno del Pino asked on 21 Apr 2010, 12:25 AM
Hello, I am trying to add a checkbox for every element in my combobox, but when I run the application and click on it, the whole page goes blank with no errors.

<telerikInput:RadComboBox x:Name="cbSalesRep1" Grid.Row="0" Grid.Column="0" FilteringMode="Contains"  ItemsSource="{Binding SalesRepList, Mode=TwoWay}"         
                                          SelectedItem="{Binding SalesRep1, Mode=TwoWay}" DisplayMemberPath="Name" IsEditable="True" IsReadOnly="False"   
                                          SelectedIndex="0" Height="25" Width="150" HorizontalAlignment="Left" Margin="26,15,22,0" TabIndex="11" telerik:StyleManager.Theme="Windows7">  
    <telerikInput:RadComboBox.ItemTemplate> 
        <DataTemplate> 
            <CheckBox IsChecked="{Binding IsChecked}" /> 
        </DataTemplate> 
    </telerikInput:RadComboBox.ItemTemplate> 
</telerikInput:RadComboBox>  
                            
                          
             


Any ideas? Thank you.

 

 

 

 

28 Answers, 1 is accepted

Sort by
0
Rafael Moreno del Pino
Top achievements
Rank 1
answered on 21 Apr 2010, 05:46 PM
It works if I delete the DisplayMemberPath property. Is this a bug?
0
Rafael Moreno del Pino
Top achievements
Rank 1
answered on 21 Apr 2010, 06:08 PM
Ok, so I could do it this way:

<telerikInput:RadComboBox x:Name="cbSalesRep1" Grid.Row="0" Grid.Column="0" FilteringMode="Contains"  ItemsSource="{Binding SalesRepList, Mode=TwoWay}"         
                                          SelectedItem="{Binding SalesRep1, Mode=TwoWay}" IsEditable="True" IsReadOnly="False" 
                                          SelectedIndex="0" Height="25" Width="150" HorizontalAlignment="Left" Margin="26,15,22,0" TabIndex="11" telerik:StyleManager.Theme="Windows7">  
                            <telerikInput:RadComboBox.ItemTemplate> 
                                <DataTemplate> 
                                    <CheckBox Content="{Binding Name}" /> 
                                </DataTemplate> 
                            </telerikInput:RadComboBox.ItemTemplate> 
                            <telerikInput:RadComboBox.Effect> 
                                <DropShadowEffect BlurRadius="2" Direction="220" Opacity="0.3" ShadowDepth="2" Color="#FF252E8C"/>  
                            </telerikInput:RadComboBox.Effect> 
                </telerikInput:RadComboBox>    

But I have to problems now, SelectedIndex=0 is not selecting the first checkbox, and the autocomplete/filter functionality is not working.

What I would like is to have those checkboxes plus the filtering and autocomplete functionalities.

Any suggestion?
0
Konstantina
Telerik team
answered on 23 Apr 2010, 03:45 PM
Hello Rafael,

Thank you for contacting us.

Please find the attached file in which this approach is illustrated.

If you need further assistance let us know.

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
Bryan
Top achievements
Rank 1
answered on 03 May 2010, 10:23 PM
Hello,

Your checkablecombo application looks to be exactly what I am needing however for some reason when I try to convert it from C# to VB it gives me issues on the
NotifyPropertyChanged.cs & DataItemCollection.cs files,
could you please translate this project to vb so that I may use it in my project?

I do appreciate it.
Bryan
0
Boyan
Telerik team
answered on 06 May 2010, 02:29 PM
Hello Bryan,

I have attached the converted project. If you have further questions please let me know.

All the best,
Boyan
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
Irina
Top achievements
Rank 1
answered on 23 Jul 2010, 03:42 PM
Thank you, Konstantina!
This is realy cool and useful combobox!!
0
joe castle
Top achievements
Rank 1
answered on 22 Sep 2010, 12:21 PM
Hi,

Will multi selection be standard functionality in the near future? Like Infragistics has xamlComboEditor with autocomplete etc...

Thanks
0
Valeri Hristov
Telerik team
answered on 22 Sep 2010, 12:28 PM
Hello Joe,

We cannot promice a specific date for delivery of this feature right now, but most probably RadComboBox will not support multi-selection in Q1 2011.

Sincerely yours,
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
Kakone
Top achievements
Rank 1
answered on 30 Sep 2010, 10:27 AM
Hello,

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
Christian Moravek
Top achievements
Rank 1
answered on 25 Feb 2011, 10:55 AM
Hello Boyan

The provided combobox works nice. But i have run into one issue. After my page loaded sucessfully and i dropdown the combobox and directly use the checkbox, then the selection box gets not updated (and also the SelectionChanged event is not fired). If i click once in the white area next to the checkbox or right to the checkbox text, then it starts working correctly. Then every time i check/uncheck a value, the selection box gets updated.

Till now i have not found a solution for that. I am using the rad combobox in Silverlight controls 2010.3_1110

Any ideas the get rid of this behavior ?

Best regards
Christian
0
Boyan
Telerik team
answered on 02 Mar 2011, 04:12 PM
Hello Christian Moravek,

I was not able to reproduce the bad behavior. At my side the checked item is updated fine after directly using the checkbox after opening the ComboBox. I have attached a video how it is behaving at my side. As for the Selection_Changed I can't think of a way to trigger properly in this custom implementation.

 I would advice you to wait for a few months when we will provide an out of the box support for multiple selection in RadComboBox. I believe that an early preview of it will be available in April.

Best wishes,
Boyan
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
Jon
Top achievements
Rank 1
answered on 04 May 2011, 11:09 PM
Hello,

Do you have a time frame for when multi-select will be available in the RadComboBox control?

Thank you,

Jon
0
Yana
Telerik team
answered on 10 May 2011, 02:58 PM
Hello Jon,

Unfortunately multiple selection feature of RadComboBox was delayed due to other tasks with higher priority. Most probably it will not be included in Q2 release. We're sorry for the inconvenience.

All the best,
Yana
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
john doe
Top achievements
Rank 1
answered on 15 Jun 2011, 02:22 PM

Hello "Christian" or any Telerik Admin.

Did you by any chance found any solution to the problem of :

"If i click once in the white area next to the checkbox or right to the checkbox text, then it starts working correctly. Then every time i check/uncheck a value, the selection box gets updated."

I have not found the solution yet. And multichoice by Telerik is still some time away. If anybody have an answer for this problem please do share it. Thank you very much.

Damir

0
Yana
Telerik team
answered on 17 Jun 2011, 04:08 PM
Hi Damir,

We're still not able to reproduce this issue. Please send us more details or a short video which will help us observe the problem. Thanks

Best wishes,
Yana
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
jfkrueger
Top achievements
Rank 1
answered on 14 Nov 2011, 06:54 AM
I have the exact same issue. It occurs when getting your data from a service rather than hard-coded:

Private Sub initCombo()
  
    'create the source of the checkedCombo
    'cs = New ComboBoxSource()
  
    ''Hard coded select All Item
    'cs.Add(New MyDataItem("All", "All", True))
  
    ''Add other Items you want
    'cs.Add(New MyDataItem("1", "1", True))
    'cs.Add(New MyDataItem("2", "2", True))
    'cs.Add(New MyDataItem("3", "3", True))
    'cs.Add(New MyDataItem("4", "4", True))
  
    'DataBinding
    'radCombo1.ItemsSource = cs
  
    Dim lSelectedGroup As String = CType(RadComboBoxGroups.SelectedValue, GroupData).GroupNumber
    Dim lGroupService As New GroupService.GroupDashboardServiceClient
  
    AddHandler lGroupService.GetDivisionsForGroupForDashboardCompleted, AddressOf GetDivisionsForGroupForDashboardCallback
  
    lGroupService.GetDivisionsForGroupForDashboardAsync(lSelectedGroup, True)
  
End Sub
  
Private Sub GetDivisionsForGroupForDashboardCallback(ByVal sender As Object, ByVal e As GroupService.GetDivisionsForGroupForDashboardCompletedEventArgs)
  
    If DesignerProperties.IsInDesignTool Then
        Return
    End If
  
    Dim cs As New ComboBoxSource()
  
    Dim lRecords As List(Of Dictionary(Of String, String)) = e.Result
  
    For Each lRecord As Dictionary(Of String, String) In lRecords
        cs.Add(New MyDataItem(lRecord("Division").ToString.Trim, lRecord("Division").ToString.Trim, True))
    Next
  
    'DataBinding
    radCombo1.ItemsSource = cs  
  
End Sub

If I run the code as is the behavior stated by Damir occurs. If I uncomment the commented out sections and then comment out the lines that make the service call so that the data is hard-coded it works as expected and I do not have to click off in the white space of a comboboxitem (off to the right of the text where it will not toggle the checkbox but it just closes the dropdown) to get it to work. Please provide a solution to this issue as this has still not been addressed as of Q2 2011 SP1.

Thanks!
0
Yana
Telerik team
answered on 16 Nov 2011, 03:00 PM
Hi Joe,

Could you please open a support ticket and send us a simple example there so we to be able to test the scenario? Thanks in advance

Greetings,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
R.
Top achievements
Rank 1
answered on 04 Dec 2011, 10:46 AM

I had the same issue using MVVM + Ria Services databinding. I was able to resolve the selection issue by setting the selected index when the RadComboBox is loaded. 

private void RadComboBox_Loaded(object sender, RoutedEventArgs e)

{

    this.RadComboBox.SelectedIndex = 0;

}

0
jfkrueger
Top achievements
Rank 1
answered on 04 Dec 2011, 12:33 PM
Thanks that definitely takes care of the issue on the initial loading. Now the problem is only occurring when I change the value in the first combobox and the 2nd combobox gets re-bound (because the data is based off of the selection in the first). The text will go away and the behavior described before occurs.

Thanks again, getting closer!
0
guga
Top achievements
Rank 1
answered on 03 Apr 2012, 02:34 PM
How can I validate that the selection is not empty?

Thanks in advance...
0
Yana
Telerik team
answered on 09 Apr 2012, 09:03 AM
Hello,

In order to add validation, I would suggest to implement IDataErrorInfo interface in your ViewModel, the approach is demonstrated here.

Regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Scott Waye
Top achievements
Rank 2
Veteran
Iron
answered on 21 Jun 2012, 06:47 PM
This is good, but it needs the mouse to select the items, would be better if the highlighted row could be checked/unchecked with the space key.  Is that possible?
0
Yana
Telerik team
answered on 27 Jun 2012, 11:56 AM
Hi Scott,

There is no easy way to achieve this behavior as when the "Enter" key is pressed, the dropdown is closed. You cannot handle the KeyDown event.

Kind regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Scott Waye
Top achievements
Rank 2
Veteran
Iron
answered on 28 Jun 2012, 06:40 AM
Thanks for the reply.  Is it possible to change this for a future version, .i.e. expose the keydown event so that we can use it to toggle the selection?
0
Yana
Telerik team
answered on 03 Jul 2012, 02:14 PM
Hi Scott,

I am sorry I did not explained clearly enough.

RadComboBox is designed to work like this, you can still handle KeyDown by creating a new class which inherits from RadComboBox and overriding its HandleKeyDown:

public class CustomComboBox : RadComboBox
{
    protected override bool HandleKeyDown(Key systemKey, int platformKeyCode)
    {
        return base.HandleKeyDown(systemKey, platformKeyCode);
    }
}
but you cannot easily find the selected item and prevent the dropdown from closing.
I am afraid that we cannot change this behavior as this will introduce a breaking change.

We're sorry for the any inconvenience caused.

Kind regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Scott Waye
Top achievements
Rank 2
Veteran
Iron
answered on 07 Jul 2012, 04:09 PM
Actually that seems to do the trick quite well.  Taking the MultiSelectComboBox , I added this and it seems to work well:

 

protected override bool HandleKeyDown(Key systemKey, int platformKeyCode)
{
    if(systemKey == Key.Space)
    {
        foreach(var item in Items)
        {
            var container = ItemContainerGenerator.ContainerFromItem(item) as RadComboBoxItem;
            if(container.IsHighlighted)
            {
                var cb = container.FindChildByType<CheckBox>();
                if(cb != null)
                {
                    cb.IsChecked = !cb.IsChecked;
                }
            }
        }
    }
    return base.HandleKeyDown(systemKey, platformKeyCode);
}

Thanks

 

 

 

 

 

0
Syed
Top achievements
Rank 1
answered on 13 Oct 2014, 06:53 AM
Hi Konstantina,

The provided demo work's fine with single instance(on combobox on screen), But When i go for two combobox on same user control. It behavior get lost, only latest combox work's fine some time. (Bot combobox has checkbox functionality)

Can you suggest something.  
0
Kalin
Telerik team
answered on 14 Oct 2014, 07:02 AM
Hello Syed,

Note that the project attached in this thread is just a sample implementation demonstrating the desired functionality - multiselection is actually not supported from the ComboBox. That is why it is highly possible to misbehave in a certain scenarios. What I can recommend you would be to check the AutoCompleteBox control, that support multiple selection out of the box and provides many other helpful features.

Hope this helps.

Regards,
Kalin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ComboBox
Asked by
Rafael Moreno del Pino
Top achievements
Rank 1
Answers by
Rafael Moreno del Pino
Top achievements
Rank 1
Konstantina
Telerik team
Bryan
Top achievements
Rank 1
Boyan
Telerik team
Irina
Top achievements
Rank 1
joe castle
Top achievements
Rank 1
Valeri Hristov
Telerik team
Kakone
Top achievements
Rank 1
Christian Moravek
Top achievements
Rank 1
Jon
Top achievements
Rank 1
Yana
Telerik team
john doe
Top achievements
Rank 1
jfkrueger
Top achievements
Rank 1
R.
Top achievements
Rank 1
guga
Top achievements
Rank 1
Scott Waye
Top achievements
Rank 2
Veteran
Iron
Syed
Top achievements
Rank 1
Kalin
Telerik team
Share this question
or