No way to clear multiple selections

5 posts, 1 answers
  1. Alex
    Alex avatar
    3 posts
    Member since:
    Jan 2012

    Posted 08 Jan 2013 Link to this post

    I can't find a way to clear selected items when RadAutoCompleteBox SelectionMode is set to "Multiple". I don't want to re-instantiate a new one just to clear selections.
  2. Ivo
    Admin
    Ivo avatar
    390 posts

    Posted 08 Jan 2013 Link to this post

    Hi Alex,

    I believe that casting the SelectedItems to IList and calling the Clear() method will help you.
    var list = this.AutoComplete.SelectedItems as IList;
    if (list != null)
    {
        list.Clear();
    }

    All the best,
    Ivo
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Alex
    Alex avatar
    3 posts
    Member since:
    Jan 2012

    Posted 09 Jan 2013 Link to this post

    What about the visual representation of clearing the selections from the control? It's not happening. How to programmatically remove or add items to the control and have the control reflect the changes? Why can't it behave more like a ListBox in that aspect where you can do things like listBox1.SelectionItems.Add(item)? 

    RadAutoCompleteBox just doesn't feel like a completely functional control like it should.
  5. Answer
    Ivo
    Admin
    Ivo avatar
    390 posts

    Posted 11 Jan 2013 Link to this post

    Hi Alex,

    I tried this and it worked as expected. You can find my sample project attached. It would be great if you modify it to demonstrate the issue and send it back to us so we will be able to investigate it further. We will also consider changing the Selecteditems' interface from IEnumerable to IList.

    Greetings,
    Ivo
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Alex
    Alex avatar
    3 posts
    Member since:
    Jan 2012

    Posted 11 Jan 2013 Link to this post

    I found that I didn't have the latest RadControls. After upgrading to the latest, this issue went away. But yes, it would be better if one doesn't need to cast SelectedItems to IList in order to perform clear, add, remove item operations. Thanks for looking into this.
Back to Top
UI for WPF is Visual Studio 2017 Ready