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

Can't Close RadAutoCompleteBox when Manually Opened in _GotFocus Event

4 Answers 91 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
The Bearded One
Top achievements
Rank 1
The Bearded One asked on 04 Aug 2017, 11:27 AM

We are trying to use a RadAutoCompleteBox on a Windows tablet. The use case is that a user needs to tap the field to open it and see all the results. This works fine. When the field is tapped, we do something like this...

public void SomeField_GotFocus(object sender, RoutedEventArgs e)
{
   var autoCompleteBox = sender as RadAutoCompleteBox;
       if (autoCompleteBox != null && !autoCompleteBox.IsDropDownOpen)
   {
        autoCompleteBox.Suggest(autoCompleteBox.Text);
   }
}

After an item is selected, this event is fired

public void SomeField_SelectionChanged(object sender, SelectionChangedEventArgs e)

 

...the Telerik control puts the cursor (focus) back in the original field, which fires the _GotFocus event again, which opens the autocomplete list again.

In this cycle, it isn't possible to get the RadAutoCompleteBox to close.

 

Looking at the API i don't see any methods to explicitly close the list.

I could work around it if I could get any other event (non-GotFocus) to fire when the control is selected, but I haven't been able to get the RadAutoCompleteBox to respond to _Tapped or _Click type events.

Anyone have any ideas?

 

Requirements I'm Trying to Satisfy

- RadAutoCompleteBox must open on tap (whether there is data in the field or not)

- Selecting item should set the value and close the item list

 

4 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 07 Aug 2017, 01:47 PM
Hi Mark,

In order to achieve the desired behavior of RadAutoCompleteBox you could handle the Tapped event of the TextBox placed inside the control and call the Suggest method from inside it.

Please, check the attached sample that demonstrates the described above approach.

Hope this helps.

Regards,
Nasko
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jenny
Top achievements
Rank 1
answered on 23 Nov 2017, 08:17 AM

useful information here

dragon ball super

0
mostafa
Top achievements
Rank 1
answered on 02 Feb 2018, 10:42 AM

when autosuggestbox is visibility.collapsed

taped button dont work because of loader return null

what should i do?

0
Nasko
Telerik team
answered on 06 Feb 2018, 10:53 AM
Hi Mostafa,

From the provided description of your issue we are not exactly sure about the exact setup of the control and what is the behavior you are observing. Could you please, provide a sample project that demonstrates the observed issue - thus we will be able to observe it on our side as well and we will try to provide you a prompt solution if possible?

We are looking forward to hearing from you.

Regards,
Nasko
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
AutoCompleteBox
Asked by
The Bearded One
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Jenny
Top achievements
Rank 1
mostafa
Top achievements
Rank 1
Share this question
or