private static void OnTextPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { SearchTextBox stb = o as SearchTextBox; if (stb != null) { stb.UpdateSearchButtonIsEnabled(); } }
private static void OnAllowEmptySearchesChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { SearchTextBox stb = o as SearchTextBox; bool allowEmptySearches = (bool)e.NewValue; if (stb != null && stb._searchButtonHost != null) { if (allowEmptySearches) { stb._searchButtonHost.IsEnabled = stb.Command?.CanExecute(stb.CommandParameter) ?? true; } else { stb.UpdateSearchButtonIsEnabled(); } } }