示例#1
0
        private void ReplaceBar_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)
                {
                    OnFindAndReplaceButtonClicked?.Invoke(sender,
                                                          new FindAndReplaceEventArgs(GetSearchContext(), ReplaceBar.Text, FindAndReplaceMode.Replace, SearchDirection.Previous));
                }
                else
                {
                    ReplaceButton_OnClick(sender, e);
                }
            }
            else if (e.Key == VirtualKey.Tab)
            {
                e.Handled = true;
                if (ReplaceBarPlaceHolder.Visibility == Visibility.Visible)
                {
                    FindBar.Focus(FocusState.Programmatic);
                }
            }
        }
 private void ReplaceBar_OnKeyDown(object sender, KeyRoutedEventArgs e)
 {
     if (e.Key == VirtualKey.Tab)
     {
         e.Handled = true;
         if (ReplaceBarPlaceHolder.Visibility == Visibility.Visible)
         {
             FindBar.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 ReplaceBar_OnKeyDown(object sender, KeyRoutedEventArgs e)
        {
            if (e.Key == VirtualKey.Enter && !string.IsNullOrEmpty(FindBar.Text))
            {
                _enterPressed = true;
                ReplaceButton_OnClick(sender, e);
            }

            if (e.Key == VirtualKey.Tab)
            {
                e.Handled = true;
                if (ReplaceBarPlaceHolder.Visibility == Visibility.Visible) FindBar.Focus(FocusState.Programmatic);
            }
        }
示例#6
0
 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);
     }
 }
示例#7
0
        private void ReplaceBar_OnKeyDown(object sender, KeyRoutedEventArgs e)
        {
            var ctrlDown = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down);
            var altDown  = Window.Current.CoreWindow.GetKeyState(VirtualKey.Menu).HasFlag(CoreVirtualKeyStates.Down);

            if (!ctrlDown && !altDown && e.Key == VirtualKey.Enter && !string.IsNullOrEmpty(FindBar.Text))
            {
                _enterPressed = true;
                ReplaceButton_OnClick(sender, e);
            }

            if (e.Key == VirtualKey.Tab)
            {
                e.Handled = true;
                if (ReplaceBarPlaceHolder.Visibility == Visibility.Visible)
                {
                    FindBar.Focus(FocusState.Programmatic);
                }
            }
        }
 public void Focus()
 {
     FindBar.Focus(FocusState.Programmatic);
 }