Closed greg-hrv closed 4 years ago
I'm a bit confused. In your example you're setting text to 12
and not clearing it?
@dotMorten Sorry, here is my real case.
First of all, I fill the ItemSource with data from an API.
After select an item, the SuggestionChosen event save the selected item in the local database.
Then, when the item is saved, I would like to reset the text to "Empty" like :
AutoSuggestBox box = (AutoSuggestBox)sender; suggestBox.Text = string.Empty;
But the "suggestBox.Text = string.Empty;" throws an error and I don't understand why.
Hi all,
Is there a way to clear the text field after select ? For instance, in my constructor, I set the text field like : suggestBox.Text = "12". It's okay. But when I set the same instruction in SuggestionChosen event, I have an error. Here is my code :
void OnSuggestBoxSuggestionChosen(System.Object sender, dotMorten.Xamarin.Forms.AutoSuggestBoxSuggestionChosenEventArgs e) { AutoSuggestBox box = (AutoSuggestBox)sender; suggestBox.Text = "12"; }
Here is the error : Message : Length cannot be less than zero. Parameter name: length
Have you any ideas ?
Thanks