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

No way to clear multiple selections

7 Answers 184 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 08 Jan 2013, 06:40 AM
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.

7 Answers, 1 is accepted

Sort by
0
Ivo
Telerik team
answered on 08 Jan 2013, 08:23 AM
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.

0
Alex
Top achievements
Rank 1
answered on 09 Jan 2013, 06:46 AM
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.
0
Accepted
Ivo
Telerik team
answered on 11 Jan 2013, 01:21 PM
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.

0
Alex
Top achievements
Rank 1
answered on 12 Jan 2013, 03:30 AM
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.
0
Sreelaskshmi
Top achievements
Rank 1
answered on 07 Sep 2017, 06:12 AM

HI Ivo,

In my case ,user want to select all selected items(4016,4011 please refer attachment) by pressing the ctrl+A & press delete to clear the items.

Please let me know ,How to implement this requirement. 

Thanks,

Mohan G

0
Dinko | Tech Support Engineer
Telerik team
answered on 12 Sep 2017, 06:05 AM
Hello Sreelaskshmi,

We will check your scenario and contact you again as soon as we have more information about your case.

Thank you for your patience.

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
0
Dinko | Tech Support Engineer
Telerik team
answered on 12 Sep 2017, 03:34 PM
Hello Sreelaskshmi,

Thank you for your patience.

RadAutoCompleteBox doesn't support selecting the selected items and clear them using the delete key. But you can achieve such behavior by subscribing to the PreviewKeyDown event and set the SelectedItems collection of the RadAutoCompleteBox to null.

I have created sample project which demonstrates one way which you can use to achieve such behavior. I have also added a visual notification of the items when you pressed CTRL+A key combination. I think this project is a good starting point for achieving your final behavior. You can additionally modify the project so it covers all your cases in your main application.

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
AutoCompleteBox
Asked by
Alex
Top achievements
Rank 1
Answers by
Ivo
Telerik team
Alex
Top achievements
Rank 1
Sreelaskshmi
Top achievements
Rank 1
Dinko | Tech Support Engineer
Telerik team
Share this question
or