private void TextEditor_Unloaded(object sender, RoutedEventArgs e) { if (!(sender is TextEditor textEditor)) { return; } textEditor.TextChanging -= TextEditor_TextChanging; textEditor.SelectionChanged -= TextEditor_SelectionChanged; if (Sets.Items?.Count == 0) { Application.Current.Exit(); } if (SearchBarPlaceHolder.Visibility == Visibility.Visible) { SearchBarPlaceHolder.Dismiss(); } }
private void ShowFindAndReplaceControl(bool showReplaceBar) { var findAndReplace = (FindAndReplaceControl)SearchBarPlaceHolder.Content; if (findAndReplace == null) { return; } SearchBarPlaceHolder.Height = findAndReplace.GetHeight(showReplaceBar); findAndReplace.ShowReplaceBar(showReplaceBar); if (SearchBarPlaceHolder.Visibility == Visibility.Collapsed) { SearchBarPlaceHolder.Show(); } Task.Factory.StartNew( () => Dispatcher.RunAsync(CoreDispatcherPriority.Low, () => findAndReplace.Focus())); }
private void FindAndReplaceControl_OnDismissKeyDown(object sender, RoutedEventArgs e) { SearchBarPlaceHolder.Dismiss(); FocusOnSelectedTextEditor(); }