This commit is contained in:
stax76
2023-11-03 17:04:26 +01:00
parent aa0e88129b
commit b41ca3cd89
17 changed files with 269 additions and 168 deletions

View File

@@ -37,9 +37,9 @@ public partial class SearchControl : UserControl
void UpdateControls()
{
HintTextBlock.Text = Text == "" ? HintText : "";
HintTextBlock.Text = string.IsNullOrEmpty(Text) ? HintText : "";
if (Text == "" || HideClearButton)
if (string.IsNullOrEmpty(Text) || HideClearButton)
SearchClearButton.Visibility = Visibility.Hidden;
else
SearchClearButton.Visibility = Visibility.Visible;
@@ -69,4 +69,13 @@ public partial class SearchControl : UserControl
_gotFocus = false;
}
}
void SearchTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape && !string.IsNullOrEmpty(Text))
{
Text = "";
e.Handled = true;
}
}
}