Cannot Clear Text Programatically
See original GitHub issueFirst off, AMAZING product! Very easy to set up and get right to using.
That being said, I am running into an issue where I cannot clear/remove the text from the field through code - the only way is to manually delete the characters through the keyboard.
I have tried the following
AutoSuggestBox.Text = string.Empty
AutoSuggestBox.Text = ""
AutoSuggestBox.SetValue(AutoSuggestBox.TextProperty, string.Empty);
AutoSuggestBox.SetValue(AutoSuggestBox.TextProperty, "");
@dotMorten, is there something that I am not doing right? I do not have any variable bindings. If not. could you please take a look at what could be causing this issue.
Thanks! Zach
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Clear text in EditText when entered [duplicate]
It's simple: declare the widget variables ( editText , textView , button etc.) in class but initialize it in onCreate after setContentView . ......
Read more >Cannot programmatically clear search text · Issue #51
It appears that the value has been cleared in the UI, however, as soon as I focus on the text box the previously...
Read more >Clear the text in text_input
I can get the text entered by a user for streamlit.text_input. Is there a way to empty the text that was entered?
Read more >Unable to programmatically clear single selection #4749
When trying to programmatically clear a selection, and return to the placeholder value, none of the following examples are working (found in ...
Read more >[Solved] how to clear EditText's Content in android
but our method has to clear EditText which is clicked by user . the only thing you should do is to get id...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Aaah I see! Luckily this was fixed with commit https://github.com/dotMorten/XamarinFormsControls/commit/6aae1dafc6fb2564ac15b08fd6e27e9afc4583bf 😄
Here’s a simple repro using your version
0.5.0
. If you set a breakpoint on theText
setter in the main page, you’ll see that after the page assigns a value to the property, the AutoSuggestBox turns around and sets it toString.Empty
via the two-way binding.(Context: my goal is to simply to assign an initial value to the AutoSuggestBox’s text.)
XamarinFormsSample.zip