@@ -115,6 +115,54 @@ private static void OnLineNumberPropertyChanged(DependencyObject d, DependencyPr
115115 ctrl . _partTextEditor . TextArea . Caret . Line = line ;
116116 }
117117
118+ public static readonly DependencyProperty IsMatchCaseProperty = DependencyProperty . Register ( "IsMatchCase" , typeof ( bool ) , _typeofSelf , new PropertyMetadata ( OnIsMatchCasePropertyChanged ) ) ;
119+ public bool IsMatchCase
120+ {
121+ get { return ( bool ) GetValue ( IsMatchCaseProperty ) ; }
122+ set { SetValue ( IsMatchCaseProperty , value ) ; }
123+ }
124+
125+ private static void OnIsMatchCasePropertyChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
126+ {
127+ var ctrl = d as TextEditorEx ;
128+ var isMatchCase = ( bool ) e . NewValue ;
129+
130+ if ( ctrl . _searchPanel != null )
131+ ctrl . _searchPanel . MatchCase = isMatchCase ;
132+ }
133+
134+ public static readonly DependencyProperty IsWholeWordsProperty = DependencyProperty . Register ( "IsWholeWords" , typeof ( bool ) , _typeofSelf , new PropertyMetadata ( OnIsWholeWordsPropertyChanged ) ) ;
135+ public bool IsWholeWords
136+ {
137+ get { return ( bool ) GetValue ( IsWholeWordsProperty ) ; }
138+ set { SetValue ( IsWholeWordsProperty , value ) ; }
139+ }
140+
141+ private static void OnIsWholeWordsPropertyChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
142+ {
143+ var ctrl = d as TextEditorEx ;
144+ var isWholeWords = ( bool ) e . NewValue ;
145+
146+ if ( ctrl . _searchPanel != null )
147+ ctrl . _searchPanel . WholeWords = isWholeWords ;
148+ }
149+
150+ public static readonly DependencyProperty UseRegexProperty = DependencyProperty . Register ( "UseRegex" , typeof ( bool ) , _typeofSelf , new PropertyMetadata ( OnUseRegexPropertyChanged ) ) ;
151+ public bool UseRegex
152+ {
153+ get { return ( bool ) GetValue ( UseRegexProperty ) ; }
154+ set { SetValue ( UseRegexProperty , value ) ; }
155+ }
156+
157+ private static void OnUseRegexPropertyChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
158+ {
159+ var ctrl = d as TextEditorEx ;
160+ var useRegex = ( bool ) e . NewValue ;
161+
162+ if ( ctrl . _searchPanel != null )
163+ ctrl . _searchPanel . UseRegex = useRegex ;
164+ }
165+
118166 public static readonly DependencyProperty IsModifiedProperty = TextEditor . IsModifiedProperty . AddOwner ( _typeofSelf ) ;
119167 public bool IsModified
120168 {
@@ -208,7 +256,10 @@ public override void OnApplyTemplate()
208256 base . OnApplyTemplate ( ) ;
209257
210258 if ( _searchPanel != null )
211- _searchPanel . Uninstall ( ) ;
259+ {
260+ _searchPanel . SearchOptionsChanged -= _searchPanel_SearchOptionsChanged ;
261+ _searchPanel . Uninstall ( ) ;
262+ }
212263
213264 if ( _partTextEditor != null )
214265 {
@@ -235,8 +286,17 @@ public override void OnApplyTemplate()
235286 _partTextEditor . TextArea . SelectionForeground = null ;
236287
237288 _searchPanel = SearchPanel . Install ( _partTextEditor . TextArea ) ;
238- _searchPanel . MarkerBrush = new SolidColorBrush ( ( Color ) ColorConverter . ConvertFromString ( "#F6B94D" ) ) ;
239289 }
290+
291+ if ( _searchPanel != null )
292+ {
293+ IsMatchCase = _searchPanel . MatchCase ;
294+ IsWholeWords = _searchPanel . WholeWords ;
295+ UseRegex = _searchPanel . UseRegex ;
296+
297+ _searchPanel . MarkerBrush = new SolidColorBrush ( ( Color ) ColorConverter . ConvertFromString ( "#F6B94D" ) ) ;
298+ _searchPanel . SearchOptionsChanged += _searchPanel_SearchOptionsChanged ;
299+ }
240300 }
241301
242302 #endregion
@@ -249,6 +309,13 @@ private void _timer_Tick(object sender, EventArgs e)
249309 RaiseEvent ( new RoutedEventArgs ( DelayArrivedEvent ) ) ;
250310 }
251311
312+ private void _searchPanel_SearchOptionsChanged ( object sender , SearchOptionsChangedEventArgs e )
313+ {
314+ IsMatchCase = e . MatchCase ;
315+ IsWholeWords = e . WholeWords ;
316+ UseRegex = e . UseRegex ;
317+ }
318+
252319 private void _partTextEditor_TextChanged ( object sender , EventArgs e )
253320 {
254321 RefreshFoldings ( ) ;
0 commit comments