Bind Multipleselection resourcetype to list in custom appointment

2 posts, 0 answers
  1. Adnan
    Adnan avatar
    4 posts
    Member since:
    Nov 2015

    Posted 26 Nov 2015 Link to this post

     I have a custom appointment object that needs to store resources of a certain type, for this I have an observablecollection. 

    Now I have my combobox with my resources in the editappointment window. 

                Jobb job = new Jobb()
                        { StandardTid = 30, UppskattatPris = 250, ResourceName = "Klippning", DisplayName = "Klippning", ResourceType="Jobb" };
                Jobb job2 = new Jobb()
                        { StandardTid = 120, UppskattatPris = 650, ResourceName = "Färgning", DisplayName = "Färgning", ResourceType = "Jobb" };

                ResourceType jobbet = new ResourceType("Jobb");


                jobbet.AllowMultipleSelection = true;
                ResourceTypeCollection resourcetypelist = new ResourceTypeCollection();


                bokningView.ResourceTypesSource = resourcetypelist;


    This shows up Ok. But how do i bind the selections from this combobox to my collection in my custom appointment ?


  2. Nasko
    Nasko avatar
    698 posts

    Posted 01 Dec 2015 Link to this post

    Hi Adnan,

    RadComboBox by design in its current implementation does not support multiple selection out of the box and because of that it does not provided SelectedItems that could be bound to a property inside your custom Appointment. So, we could suggest you two approaches that could help you achieve a similar to the desired functionality and get access to the selected items.

    1. To use an attached property that needs to be bound to the ResourceItems property part of the ResourceTypeViewModel to which the ComboBox is bound to (this is its DataContext).

    2. The second approach is to modify the default template of the ResourcesEditorItemTemplateSelector and replace the ComboBox with RadAutoCompleteBox that supports multiple selection out of the box and you could easily get access to the selected items. Please, check the following SDK example that demonstrates how to add button to RadAutoCompleteBox, in order to be more similar to RadComboBox:

    We have also created a sample project that demonstrates the first described approach - the selected items you could get inside the "SelectedItemsHelper" class in the OnSelectedItemsChanged method.

    Hope this helps.

    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 Feedback Portal and vote to affect the priority of the items
Back to Top