Multi select for the combobox

29 posts, 0 answers
  1. Rafael Moreno del Pino
    Rafael Moreno del Pino avatar
    4 posts
    Member since:
    Feb 2010

    Posted 20 Apr 2010 Link to this post

    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.

     

     

     

     

  2. Rafael Moreno del Pino
    Rafael Moreno del Pino avatar
    4 posts
    Member since:
    Feb 2010

    Posted 21 Apr 2010 Link to this post

    It works if I delete the DisplayMemberPath property. Is this a bug?
  3. DevCraft banner
  4. Rafael Moreno del Pino
    Rafael Moreno del Pino avatar
    4 posts
    Member since:
    Feb 2010

    Posted 21 Apr 2010 Link to this post

    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?
  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 23 Apr 2010 Link to this post

    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.
  6. Bryan
    Bryan avatar
    4 posts
    Member since:
    Mar 2008

    Posted 03 May 2010 Link to this post

    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
  7. Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 06 May 2010 Link to this post

    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.
  8. Irina
    Irina avatar
    1 posts
    Member since:
    Jul 2010

    Posted 23 Jul 2010 Link to this post

    Thank you, Konstantina!
    This is realy cool and useful combobox!!
  9. joe castle
    joe castle avatar
    39 posts
    Member since:
    Jan 2005

    Posted 22 Sep 2010 Link to this post

    Hi,

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

    Thanks
  10. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 22 Sep 2010 Link to this post

    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
  11. Kakone
    Kakone avatar
    65 posts
    Member since:
    Jan 2010

    Posted 30 Sep 2010 Link to this post

    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.
  12. Christian Moravek
    Christian Moravek avatar
    2 posts
    Member since:
    Feb 2010

    Posted 25 Feb 2011 Link to this post

    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
  13. Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 02 Mar 2011 Link to this post

    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
  14. Jon
    Jon avatar
    3 posts
    Member since:
    May 2011

    Posted 04 May 2011 Link to this post

    Hello,

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

    Thank you,

    Jon
  15. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 10 May 2011 Link to this post

    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
  16. john doe
    john  doe avatar
    11 posts
    Member since:
    Dec 2009

    Posted 15 Jun 2011 Link to this post

    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

  17. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 17 Jun 2011 Link to this post

    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
  18. jfkrueger
    jfkrueger avatar
    269 posts
    Member since:
    Jul 2012

    Posted 14 Nov 2011 Link to this post

    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!
  19. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 16 Nov 2011 Link to this post

    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 >>

  20. R.
    R. avatar
    1 posts
    Member since:
    Mar 2011

    Posted 04 Dec 2011 Link to this post

    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;

    }

  21. jfkrueger
    jfkrueger avatar
    269 posts
    Member since:
    Jul 2012

    Posted 04 Dec 2011 Link to this post

    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!
  22. guga
    guga avatar
    11 posts
    Member since:
    Mar 2012

    Posted 03 Apr 2012 Link to this post

    How can I validate that the selection is not empty?

    Thanks in advance...
  23. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 09 Apr 2012 Link to this post

    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 >>

  24. Scott Waye
    Scott Waye avatar
    111 posts
    Member since:
    Nov 2009

    Posted 21 Jun 2012 Link to this post

    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?
  25. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 27 Jun 2012 Link to this post

    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 >>

  26. Scott Waye
    Scott Waye avatar
    111 posts
    Member since:
    Nov 2009

    Posted 28 Jun 2012 Link to this post

    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?
  27. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 03 Jul 2012 Link to this post

    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 >>

  28. Scott Waye
    Scott Waye avatar
    111 posts
    Member since:
    Nov 2009

    Posted 07 Jul 2012 Link to this post

    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

     

     

     

     

     

  29. Syed
    Syed avatar
    9 posts
    Member since:
    Oct 2011

    Posted 13 Oct 2014 in reply to Konstantina Link to this post

    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.  
  30. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 14 Oct 2014 Link to this post

    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.

     
Back to Top
DevCraft banner