19 Answers, 1 is accepted
The Autocomplete doesn't operate like a ComboBox, therefore it doesn't have a concept of "SelectedItem" property. That being said, you can set the Text value but there appears to be an issue with DataBinding. I've reported to the development team.
To workaround this, you'll need to the Text value on the control directly
protected
override
void
OnAppearing()
{
base
.OnAppearing();
AutoComplete.Text =
"Hello World"
;
}
Note: If you do need a "SelectedItem" type of property you could hook into the control's SuggestionItemSelected event and update a view model property accordingly:
private
void
AutoComplete_OnSuggestionItemSelected(
object
sender, SuggestionItemSelectedEventArgs e)
{
(BindingContext
as
ViewModel).SelectedItem = e.DataItem
as
BusinessObject;
}
Let me know if you have any further questions or concerns.
Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik

Hi Lance,
I am looking for something similar as well. I tried your approach of assigning text but there are a couple of problems
1. the SuggestionList appears when I set the text programatically
2. I can't figure out how to set multiple tokens
Any help regarding these would be much appreciated.
Let me address your comments directly:
1 - You can programmatically hide the SuggestionView by setting the following:
ShipperAutoComplete.ShowSuggestionView =
false
;
2 - You cannot yet programmatically create Tokens
You could add Tokens to the tokens collection, but the UI will not be updated. The dev team considered exposing the Token collection as an ObservableCollection but declined it, see this feedback item for the explanation from the dev team.
However, they did approve creating an approach that lets you add Tokens programmatically, see this feedback item to upvote and follow it. At this time, if you need programmatic editing of the AutoComplete's Text, then you'll be restricted to Text mode instead of Tokens mode.
I hope I was able to answer your questions.
Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik

Is there any information when will support setting multiple tokens?
Thanks
Currently this feature request is not scheduled as the team is working on tasks with higher priority for the upcoming R1 2018 release.
You could follow the item in order to receive a notification when its status is updated.
Regards,
Yana
Progress Telerik

I am sorry to hear about your disappointment with our RadAutoComplete component. We have identified the control has limited functionality in certain scenarios and we're planning on working on this, however, this is quite a major task, and I am afraid at this point I cannot commit to any timeframe for this. I have raised the priority of the feature request and hopefully it will be included in one of the upcoming releases.
Thank you for sending your feedback.
Regards,
Yana
Progress Telerik

Thank you for sending your comment. I understand this functionality may be vital in certain cases and I am really sorry to hear about your decision not to use Telerik UI for Xamarin.
I am afraid I cannot add anything else regarding the requested feature to my previous post, still , I'd like to assure you the team is working hard on improving the suite and the components' feature-set and I hope you will consider it for future projects.
Regards,
Yana
Progress Telerik

Hello,
I'm also running into a data binding issue with the RadAutoComplete control in Xamarin Forms. I tried your suggestion by setting the Text property of the control directly but it doesn't seem to do anything, although by stepping through the code, the value of Text seems to be set correctly.
I believe I'm using the latest available version, 2018.3.1122.3.
Any help or workaround would be appreciated.
Thank you.
With R3 2018 release we introduced the new and improved RadAutoCompleteView control which should replace AutoComplete. I would recommend you use the new control as it is more intuitive and provides more features. With the upcoming R1 2019 we will make it official ( now it is in beta).
I'd also like to ask you for more details on the scenario you have, so I could think of a concrete implementation with AutoCompleteView. Are you using Tokens DisplayMode?
Looking forward to your reply.
Regards,
Yana
Progress Telerik

Hello,
Let me rectify what I said: I noticed that setting the Text property was working half the time, depending on the context in which I opened the window.
Actually, I initially started using the RadAutoCompleteView, but when I set the SuggestionItemTemplate, it would not work on Android. I don't remember the error message displayed in debug, but I can try reproducing it if need be.
To answer your question, I am not using the tokens display mode, just a simple lookup with a suggestion item template.
Thank you.
Thank you for providing the details.
I have attached a sample example with RadAutoCompleteView with SuggestionItemTemplate and Text property applied. In general, the suggestions view is displayed when the user types into the input field. However, you could explicitly open it through ShowSuggestions method.
The example such approach - to show the suggestions on focus event and in this case the set Text is taken into account for showing the filtered results.
Please give it a try and let me know how it goes. Also if you could reproduce the issue on Android, that would be of great help.
I am looking forward to your reply.
Regards,
Yana
Progress Telerik

I am using Xamarin Sell in an MVVM architecture...
So I am trying to "clear" the "selected item" in the autocomplete but I seem to be missing something ?
Here is a XAMl fragment where I am binding the Text property to a property on the view model ..
I "assume" I can set the property (JobInputJobSelected) to empty string and it will clear the autocomplete edit ?
It seems that the property (JobInputJobSelected) does not get changed when an item is selected either ?
IsEnabled="True"
IsClearButtonVisible="True"
ItemsSource="{Binding JobsFiltered}"
Text="{Binding JobInputJobSelected}"
SuggestMode="SuggestAppend"
TextSearchPath="JobAndDescription">
I am using a behavior where I get the notification like so ..
<
input:RadAutoCompleteView.Behaviors
>
<
xct:EventToCommandBehavior
EventName
=
"SuggestionItemSelected"
Command
=
"{Binding JobSuggestionSelectedCommand}"
/>
</
input:RadAutoCompleteView.Behaviors
>
But what am I missing on how to "clear" or "reset" the text in the view model ?
Hi Stephen,
If you use the "Plain" DisplayMode (default one), setting the Text bound property to null should clear the selection in the AutoCompleteView. I have attached my test project to show you how it works on my side. Please take a look and compare it to the setup you have. Let me know if I am missing something related to the scenario.
I look forward to your reply.
Regards,
Yana
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.

OK, setting the mode to "Mode=TwoWay" worked, I am guessing the control does not adhere to the Xamarin controls that default to 2 way binding ?
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/data-binding/binding-mode#two-way-bindings
Hello Stephen,
Indeed, the default binding mode of the Text property is OneWay. I agree it would have been better to make it TwoWay, however, I am afraid at this point this wouldn't be possible (it will introduce a breaking change).
I hope the suggested solution would be acceptable.
Regards,
Yana
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.

Thank you for the clarification but how do I know which controls / properties default to which binding mode ?
I don't have time to experiment so did I miss it in the documentation somewhere ?
Hi Stephen,
You can just define the BindingMode when you need TwoWay in all cases - this is far better and human-readable than trying to memorize and differentiate between controls and properties (such differentiation techniques leads to hidden bugs).
Still, adding the default binding mode in the documentation is a good idea, and we'll definitely have it in mind.
Regards,
Yana
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.