private void FindBar_OnKeyDown(object sender, KeyRoutedEventArgs e) { var shiftDown = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); if (e.Key == VirtualKey.Enter && !string.IsNullOrEmpty(FindBar.Text)) { _enterPressed = true; if (shiftDown) { SearchBackwardButton_OnClick(sender, e); } else { SearchForwardButton_OnClick(sender, e); } } else if (e.Key == VirtualKey.Tab) { e.Handled = true; if (ReplaceBarPlaceHolder.Visibility == Visibility.Visible) { ReplaceBar.Focus(FocusState.Programmatic); } } }
public void Focus(string searchString, FindAndReplaceMode mode) { if (_shouldUpdateSearchString && !string.IsNullOrEmpty(searchString)) FindBar.Text = searchString; if (mode == FindAndReplaceMode.FindOnly) FindBar.Focus(FocusState.Programmatic); else ReplaceBar.Focus(FocusState.Programmatic); FindBar_OnTextChanged(null, null); }
public void Focus(FindAndReplaceMode mode) { if (mode == FindAndReplaceMode.FindOnly) { FindBar.Focus(FocusState.Programmatic); } else { ReplaceBar.Focus(FocusState.Programmatic); } }
private void FindBar_OnKeyDown(object sender, KeyRoutedEventArgs e) { if (e.Key == VirtualKey.Enter && !string.IsNullOrEmpty(FindBar.Text)) { _enterPressed = true; SearchForwardButton_OnClick(sender, e); } if (e.Key == VirtualKey.Tab) { e.Handled = true; if (ReplaceBarPlaceHolder.Visibility == Visibility.Visible) ReplaceBar.Focus(FocusState.Programmatic); } }
public void Focus(FindAndReplaceMode mode) { if (mode == FindAndReplaceMode.FindOnly) { FindBar.Focus(FocusState.Programmatic); } else { if (!string.IsNullOrEmpty(FindBar.Text)) { FindBar.SelectionStart = FindBar.Text.Length; } if (!string.IsNullOrEmpty(ReplaceBar.Text)) { ReplaceBar.SelectionStart = ReplaceBar.Text.Length; } ReplaceBar.Focus(FocusState.Programmatic); } }