Answered by:
How to empty the search pane box upon pressing enter?

Question
-
Right now, I have search with suggestion enabled. How do I make it so as soon as the user presses enter the search textbox will empty?
I'm using the search to enter stuff (I'm a control freak) and I don't want to keep having to press the backspace button to get rid of the text in there to enter the next thing.
Sunday, September 8, 2013 9:14 AM
Answers
-
Hi,huge_newbie
Do you create your project in Windows 8.1? In Windows 8.1, SearchBox is a new Control. You can set the SearchBox QueryText property to string.empty when the SearchBox.QuerySubmitted event occur.
Code like this below:
private void SearchBox1_QuerySubmitted(object sender, SearchBoxQuerySubmittedEventArgs e) { Var searchbox=sender as SearchBox; Searchbox.QueryText=string.empty; }
Best Wishes!
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.
Monday, September 9, 2013 2:54 PM
All replies
-
Bump.Sunday, September 8, 2013 11:10 PM
-
Hi,huge_newbie
Do you create your project in Windows 8.1? In Windows 8.1, SearchBox is a new Control. You can set the SearchBox QueryText property to string.empty when the SearchBox.QuerySubmitted event occur.
Code like this below:
private void SearchBox1_QuerySubmitted(object sender, SearchBoxQuerySubmittedEventArgs e) { Var searchbox=sender as SearchBox; Searchbox.QueryText=string.empty; }
Best Wishes!
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.
Monday, September 9, 2013 2:54 PM -
Thank you for your answer. For now, I'm not building my apps in 8.1 simply because I ain't got no 8.1. I will add this code to my apps once 8.1 comes out.Monday, September 9, 2013 6:15 PM