diff --git a/ICSharpCode.AvalonEdit/Search/SearchPanel.cs b/ICSharpCode.AvalonEdit/Search/SearchPanel.cs index 93744289..d8e37c07 100644 --- a/ICSharpCode.AvalonEdit/Search/SearchPanel.cs +++ b/ICSharpCode.AvalonEdit/Search/SearchPanel.cs @@ -272,10 +272,15 @@ void ValidateSearchText() { if (searchTextBox == null) return; + var be = searchTextBox.GetBindingExpression(TextBox.TextProperty); + try { - Validation.ClearInvalid(be); + if (be != null) + Validation.ClearInvalid(be); + UpdateSearch(); + } catch (SearchPatternException ex) { var ve = new ValidationError(be.ParentBinding.ValidationRules[0], be, ex.Message, ex); Validation.MarkInvalid(be, ve);