Programmatic setting of SelectedItems not updating SearchText

4 posts, 0 answers
  1. Kenneth
    Kenneth avatar
    101 posts
    Member since:
    Apr 2014

    Posted 19 Apr Link to this post

    SelectionMode = Multiple, I am populating ItemsSource with with a list, then I programmatically populate SelectedItems with item from that list, but SearchText remains blank,  In Single Selection mode when I programmatically set SelectedItem the value at TextSearchPath does populateSearchText.

    In Multiple selection mode when multiple objects are selected by the user SearchText does not display simple text, but rather a series of boxes with a close button,and at that time SearchText is blank.

    How can I have the SearchTextfield display the selected items the same programmatically as when the user manually selects the items?

  2. Kenneth
    Kenneth avatar
    101 posts
    Member since:
    Apr 2014

    Posted 20 Apr in reply to Kenneth Link to this post

    Some additional info.  Before I programmtically add items user-added selection works fine.  So if I add 2 items via the user interface they are visible as boxes in searchtext, then if I programmatically add items the searchtext becomes blank even though all items are in selecteditems.  If I then try to add more items by user-interface it appears not to work because searchtext remains blank, but selecteditems has all items in it including all user and programaticlly added items.

    So once I programatically add one or more items seachtext goes blank, so I need a way to tell the control to re-build the little boxes it displays for multiple selections.

     

  3. DevCraft banner
  4. Nasko
    Admin
    Nasko avatar
    587 posts

    Posted 22 Apr Link to this post

    Hi Kenneth,

    From the provided description we are not exactly sure that we completely understand your scenario. Could you please, provide us a sample project that reproduces your issue or some code - snippets with your RadAutoCompleteBox declaration that includes all set properties and bindings if you have such?

    Thus we could try to create sample project on our side in order to reproduce the observed issue and provide you with a prompt solution.

    We are looking forward to hearing from you.

    Regards,
    Nasko
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  5. Kenneth
    Kenneth avatar
    101 posts
    Member since:
    Apr 2014

    Posted 22 Apr in reply to Nasko Link to this post

    RESOLVED

    I was using a List of my object type as shown below, but by using an ObservableCollection( Of Objects) it now works.

     

    'Dim selected As List(Of MyListItem) 'incorrect
    Dim selected As ObservableCollection(Of Object)  'this works
    'code to add items...
    TestAutoCompleteBox.SelectedItems = selected
Back to Top