Fix issue with autocomplete text remaining on clearing query (#6220)

This commit is contained in:
Divyansh Srivastava
2020-08-28 14:58:57 -07:00
committed by GitHub
parent 6a531ca57c
commit fe8727bd94

View File

@@ -318,20 +318,21 @@ namespace PowerLauncher
private void QueryTextBox_TextChanged(object sender, TextChangedEventArgs e) private void QueryTextBox_TextChanged(object sender, TextChangedEventArgs e)
{ {
var textBox = (TextBox)sender;
var text = textBox.Text;
if (string.IsNullOrEmpty(text))
{
SearchBox.AutoCompleteTextBlock.Text = string.Empty;
}
if (_isTextSetProgrammatically) if (_isTextSetProgrammatically)
{ {
var textBox = (TextBox)sender;
textBox.SelectionStart = textBox.Text.Length; textBox.SelectionStart = textBox.Text.Length;
_isTextSetProgrammatically = false; _isTextSetProgrammatically = false;
} }
else else
{ {
var text = ((TextBox)sender).Text;
if (string.IsNullOrEmpty(text))
{
SearchBox.AutoCompleteTextBlock.Text = string.Empty;
}
_viewModel.QueryText = text; _viewModel.QueryText = text;
_viewModel.Query(); _viewModel.Query();
} }