Please add a simple way to show "Clear all" button in a MultiSelect mode to clear all selected items, so we don't have to customize entire control template. Added properties could be at least those: IsClearAllButtonVisible and ClearAllButtonTemplate.
Best regards,
Vladimir
Hello Vladimir,
I am writing to you to propose an alternative solution, which will not require extracting the default template of the RadAutoCompleteBox control. The suggestion consists of modifying the SelectedItems property of the control, which can be set to null on a button click. This way, all of the selected items will be removed.
The following code snippet shows this suggestion's implementation:
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<telerik:RadAutoCompleteBox x:Name="AutoComplete"
AutoCompleteMode="Suggest"
DisplayMemberPath="Name"
TextSearchPath="Capital"
TextSearchMode="Contains"
WatermarkContent="Select a country..."
MinWidth="200"
SelectionMode="Multiple"/>
<telerik:RadButton Name="deleteBtn" Content="X" Click="deleteBtn_Click" />
</StackPanel>
private void deleteBtn_Click(object sender, RoutedEventArgs e)
{
this.AutoComplete.SelectedItems = null;
}
The button's visibility and visual representation can be controlled through its Visibility and Template properties.
With this said, may I ask if you could give this approach a try and let me know whether it would work for you?
Regards,
Stenly
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hello Vladimir,
This suggestion seems like a good addition to the API of the RadAutoCompleteBox control. As a result of this, I have logged a new item in our internal backlog and have linked it to this item, so that you could get notified via e-mail when its status gets changed.
In addition, I have updated your Telerik points as a token of gratitude for bringing this to our attention.
In the meantime, we have an SDK example, which shows how to achieve part of the desired functionality. It demonstrates how to clear the selected item in a single selection scenario, however, it could be used as a starting point for implementing this functionality when having multi-selection. The example achieves this by modifying the default template of the control to include a button and by executing additional removal logic. It could be found in our SDK Samples Browser, as well as in our GitHub repository.
I hope the provided information will be of help to you.
Regards,
Stenly
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.