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

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