RadComboBox clear search selection

1 Answer 44 Views
ComboBox
David
Top achievements
Rank 1
David asked on 10 Sep 2024, 12:32 AM

How can I clear the search box on a RadComboBox.  The only way I can clear the search text is when I use the keyboard to do so.

 

 

 

This is how I am defining the combo box.

<controls:RadComboBox
DisplayMemberPath="FullName"
DropDownButtonStyle="{StaticResource ContactDropDownStyle}"
HorizontalOptions="Fill"
IsClearButtonVisible="False"
IsDropDownClosedOnSelection="False"
IsEditable="True"
IsFilteringEnabled="True"
ItemsSource="{Binding Contacts, Mode=TwoWay}"
Loaded="OnComboBoxLoaded"
Margin="15"
OpenOnFocus="True"
Placeholder="Select Contacts"
PlaceholderColor="{StaticResource White}"
SearchTextPath="FullName"
SelectionChanged="OnContactSelectedChanged"
SelectionMode="Multiple"
TextColor="{StaticResource White}"
Unfocused="ContactComboBox_OnUnfocused"

1 Answer, 1 is accepted

Sort by
0
Didi
Telerik team
answered on 10 Sep 2024, 06:02 AM

Hi David,

The ComboBox control has a clear button which you can use to clear the text. In a multiple selection the selected items are also cleared. 

I see you have set the property to false:

IsClearButtonVisible="False"

In order to clear only the text typed in the input area you can add additional button that will clear the controls' Text. 

    <VerticalStackLayout>
        <Button Text="clear text" Clicked="Button_Clicked" />
        <telerik:RadComboBox x:Name="comboBox"
                             ItemsSource="{Binding Items}" 
                             DisplayMemberPath="Name"
                             Placeholder="Select City"
                             IsClearButtonVisible="True"
                             SelectionMode="Multiple"
                             IsEditable="True"/>
    </VerticalStackLayout>
    private void Button_Clicked(object sender, EventArgs e)
    {
        this.comboBox.Text = string.Empty;
    }

Regards,
Didi
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.

Tags
ComboBox
Asked by
David
Top achievements
Rank 1
Answers by
Didi
Telerik team
Share this question
or