private void txtMyProfile_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
 {
     if (txtMyProfile.Text == DefaultTextMySteamProfile)
     {
         txtMyProfile.Clear();
     }
 }
예제 #2
0
        private void TextBoxGotKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
        {
            TextBox box = (TextBox)sender;

            box.SelectAll();
            box.Focus();
        }
예제 #3
0
 //
 // FUNCTION : nameBox_GotKeyboardFocus
 //
 // DESCRIPTION : Handles focus of the nameBox. When it is focused (ususally through a click) the default
 //               text will change to blank.
 //
 // PARAMETERS : Object sender - contains a reference to the control/object that raised the event
 //
 //              RoutedEventArgs e - Contains state information and event data associated with a routed event.
 //              (https://docs.microsoft.com/en-us/dotnet/api/system.windows.routedeventargs?view=netframework-4.7.2)
 //
 // RETURNS : None
 //
 private void nameBox_GotKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
 {
     if (nameBox.Text == "Enter a username")
     {
         nameBox.Text = string.Empty;
     }
 }
예제 #4
0
 private void tbName_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
 {
     if (tbName.Text == "Имя")
     {
         tbName.Text = "";
     }
 }
예제 #5
0
        /// <summary>
        /// Handles TextBox.GotKeyboardFocus event.
        /// </summary>
        protected override void OnGotKeyboardFocus(System.Windows.Input.KeyboardFocusChangedEventArgs e)
        {
            if (SelectAllOnFocus)
            {
                // Select all of the text in the control.
                this.SelectAll();

                // Allow the TextBox.GotMouseCapture custom code to execute.
                CancelGotMouseCapture = true;

                // Invoke the OnFocusComplete method.  The method should run as the last step
                // of the textbox focusing logic.
                this.Dispatcher.BeginInvoke(
                    OnFocusCompleteInvoker, System.Windows.Threading.DispatcherPriority.Input, this);
            }
            else
            {
                // Select feature is disabled.  Prevent the TextBox.GotMouseCapture custom code from executing.
                if (CancelGotMouseCapture)
                {
                    CancelGotMouseCapture = false;
                }
            }

            base.OnGotKeyboardFocus(e);
        }
예제 #6
0
        private void MaskedTextBox_PreviewLostKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
        {
            int?hours;
            int?minutes;

            MaskedTextBox textbox = (sender as MaskedTextBox);

            if (!ParseTimeSpanMask(textbox.Text, textbox.PromptChar, out hours, out minutes))
            {
                return;
            }

            if (hours.HasValue && hours.Value < 10)
            {
                textbox.Text = hours.Value.ToString().PadLeft(2, '0') + textbox.Text.Substring(2);
            }

            if (minutes.HasValue && minutes.Value < 10)
            {
                textbox.Text = textbox.Text.Substring(0, 3) + minutes.Value.ToString().PadLeft(2, '0');
            }

            if (hours.HasValue || minutes.HasValue)
            {
                textbox.Text = textbox.Text.Replace(textbox.PromptChar, '0');
            }
        }
예제 #7
0
 //
 // FUNCTION : connectBox_GotKeyboardFocus
 //
 // DESCRIPTION : Handles focus of the connectBox. When it is focused (ususally through a click) the default
 //               text will change to blank.
 //
 // PARAMETERS : Object sender - contains a reference to the control/object that raised the event
 //
 //              RoutedEventArgs e - Contains state information and event data associated with a routed event.
 //              (https://docs.microsoft.com/en-us/dotnet/api/system.windows.routedeventargs?view=netframework-4.7.2)
 //
 // RETURNS : None
 //
 private void connectBox_GotKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
 {
     if (connectBox.Text == "Enter an IP")
     {
         connectBox.Text = string.Empty;
     }
 }
예제 #8
0
 private void TextBox_GotKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
 {
     if (sender is TextBox txtBox && txtBox.Text == "Вопрос")
     {
         txtBox.Text = string.Empty;
     }
 }
 protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
 {
     if (this.IsKeyboardFocusWithin)
     {
         this.lastElementWithFocus = e.NewFocus as FrameworkElement;
     }
 }
        protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
        {
            if (Model != null)
                Model.IsActive = true;

            base.OnGotKeyboardFocus(e);
        }
예제 #11
0
 private void ValidDateTextBox_PreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
 {
     if (HasError)
     {
         e.Handled = true;
     }
 }
예제 #12
0
 private void OnLostKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
 {
     if (string.IsNullOrEmpty(filterBox.Text))
     {
         textBlock.Visibility = Visibility.Visible;
     }
 }
예제 #13
0
 protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
 {
   if ((e.OldFocus is DataGridCell)) return;
   Keyboard.Focus(_lastDataGridFocus);
   if (SelectedIndex == -1 && Items.Count > 0) SelectedIndex = 0;
   e.Handled = true;
 }
예제 #14
0
 private void Window_GotKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
 {
     if (ganttControl1.IsLoaded)
     {
         RefreshEvents();
     }
 }
예제 #15
0
 private void projectTextBox_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
 {
     if (!string.IsNullOrEmpty(this.selectedProject.ProjectLabel))
     {
         this.selectProject(this.selectedProject);
     }
 }
예제 #16
0
        }        // End BtnConfirm_Click()

        private void TxtQuantityMoving_GotKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
        {
            if (e.KeyboardDevice.IsKeyDown(Key.Tab))
            {
                ((TextBox)sender).SelectAll();
            }
        }
예제 #17
0
        protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
        {
            if (SelectAllOnGotFocus)
                SelectAll();

            base.OnGotKeyboardFocus(e);
        }
예제 #18
0
 private void txtMess_LostKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
 {
     if (txtMess.Text == "")
     {
         txtMess.Text = "Type your message here...";
     }
 }
        private void textBox_LostKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
        {
            EnableEdit = false;
            BindingExpression be = textBox_float.GetBindingExpression(TextBox.TextProperty);

            be.UpdateSource();
        }
예제 #20
0
        protected override void OnGotKeyboardFocus(System.Windows.Input.KeyboardFocusChangedEventArgs e)
        {
            base.OnGotKeyboardFocus(e);

            BorderThickness = new Thickness(1);
            Margin          = new Thickness(0, 0, 8, 0);
        }
예제 #21
0
        protected override void OnPreviewLostKeyboardFocus(System.Windows.Input.KeyboardFocusChangedEventArgs e)
        {
            BindingExpression be = GetBindingExpression(TextBox.TextProperty);

            be.UpdateSource();
            base.OnPreviewLostKeyboardFocus(e);
        }
 protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)
 {
     txtReadOnly.Visibility = Visibility.Visible;
     txtEdit.Visibility = Visibility.Collapsed;
     Text = EditedText;
     base.OnLostKeyboardFocus(e);
 }
예제 #23
0
 private void Window_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
 {
     if (!closing)
     {
         this.Close();
     }
 }
예제 #24
0
 private void OnGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
 {
     if (e.OldFocus is MenuItem)
     {
         return;
     }
     SelectTextInTextBox(sender);
 }
예제 #25
0
 protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
 {
     base.OnGotKeyboardFocus(e);
     if (this.SelectedIndex == -1)
     {
         this.SelectedIndex = 0;
     }
 }
예제 #26
0
		protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)
		{
			base.OnLostKeyboardFocus(e);
			if (IsKeyboardFocusWithin)
				return;
			if (IsOpen)
				Child.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
		}
예제 #27
0
 private void Editor_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
 {
     if (_drawFocus)
     {
         _drawFocus = false;
         InvalidateVisual();
     }
 }
예제 #28
0
 private void Editor_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
 {
     if (!_drawFocus)
     {
         _drawFocus = true;
         InvalidateVisual();
     }
 }
예제 #29
0
 protected override void OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
 {
     if (!this.IsRootDesigner)
     {
         this.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action(this.BringToFront));
     }
     base.OnPreviewGotKeyboardFocus(e);
 }
예제 #30
0
		/// Forward focus to TextArea.
		/// <inheritdoc/>
		protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
		{
			base.OnGotKeyboardFocus(e);
			if (e.NewFocus == this) {
				Keyboard.Focus(this.TextArea);
				e.Handled = true;
			}
		}
예제 #31
0
 private void InputTextBox_LostKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
 {
     if (InputTextBox.Text == "")
     {
         InputTextBox.Text    = "搜索栏";
         InputTextBox.Opacity = 0.8;
     }
 }
예제 #32
0
 void OnKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
 {
     if (e.NewFocus == this)
     {
         terminalControl.Focus();
         Keyboard.Focus(terminalControl);
     }
 }
예제 #33
0
        private static void TextboxOnGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs keyboardFocusChangedEventArgs)
        {
            var textbox = sender as TextBox;
            if (textbox == null) return;

            textbox.CaretIndex = textbox.Text.Length;
            textbox.ScrollToEnd();
        }
예제 #34
0
 private void OnLostKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
 {
     if (sender is TextBox textBox)
     {
         var command = textBox.Tag as ICommand;
         command?.Execute(e);
     }
 }
예제 #35
0
		void TextAreaGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
		{
			if (this.textArea == null)
				return;
			if (e.OriginalSource != this.textArea)
				return;
			CreateContext();
		}
예제 #36
0
 private void PasswordBox_LostKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
 {
     if (passwordBox.Password.Equals(""))
     {
         passwordBox.Password   = "******";
         passwordBox.Foreground = Brushes.DarkGray;
     }
 }
예제 #37
0
 private void LoginBox_GotKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
 {
     if (textBoxLogin.Text.Equals("Username"))
     {
         textBoxLogin.Text       = "";
         textBoxLogin.Foreground = Brushes.Black;
     }
 }
예제 #38
0
 private static void OnKeyboardFocusSelectText(object sender, KeyboardFocusChangedEventArgs e)
 {
     TextBox textBox = e.OriginalSource as TextBox;
     if (textBox != null)
     {
         textBox.SelectAll();
     }
 }
예제 #39
0
		/// Forward focus to TextArea.
		/// <inheritdoc/>
		protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
		{
			base.OnGotKeyboardFocus(e);
			if (!this.TextArea.IsKeyboardFocusWithin) {
				Keyboard.Focus(this.TextArea);
				e.Handled = true;
			}
		}
예제 #40
0
        //void UpdateLogicalParent()
        //{
        //    var parentPaneControl = this.FindVisualAncestor<LayoutDocumentPaneControl>();
        //    if (parentPaneControl == null)
        //        throw new InvalidOperationException();

        //    try
        //    {
        //        if (Model != null &&
        //            Model.Content != null &&
        //            Model.Content is UIElement)
        //        {
        //            var oldLogicalParentPaneControl = LogicalTreeHelper.GetParent(Model.Content as UIElement)
        //                as ILogicalChildrenContainer;
        //            if (oldLogicalParentPaneControl == parentPaneControl)
        //                return;
        //            if (oldLogicalParentPaneControl != null)
        //                oldLogicalParentPaneControl.InternalRemoveLogicalChild(Model.Content);
        //        }

        //        if (Model != null &&
        //            parentPaneControl != null &&
        //            Model.Content != null &&
        //            Model.Content is UIElement)
        //        {
        //            ((ILogicalChildrenContainer)parentPaneControl).InternalAddLogicalChild(Model.Content);
        //            //BindingHelper.RebindInactiveBindings(Model.Content as UIElement);
        //        }
        //    }
        //    finally
        //    {
        //        if (Model != null && Model.Content is DependencyObject)
        //            BindingHelper.RebindInactiveBindings(Model.Content as DependencyObject);
        //    }
        //}

        #endregion

        protected override void OnPreviewGotKeyboardFocus(System.Windows.Input.KeyboardFocusChangedEventArgs e)
        {
            if (Model != null)
            {
                Model.IsActive = true;
            }
            base.OnPreviewGotKeyboardFocus(e);
        }
        private void OnListBoxPreviewGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            ListBoxItem item = VisualTreeUtils.FindVisualAncestor<ListBoxItem>(e.OriginalSource as DependencyObject);

            if (item != null)
            {
                this.SelectedListItem = item.Content as ExpandableItemWrapper;
            }
        }
        /// <summary>
        /// Handles the keyboard focus event
        /// </summary>
        private void textBox_GotKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
        {
            //prepare popup with values.
            PreparePopup();

            //attach the events
            sourceTextBox.AddHandler(FrameworkElement.PreviewKeyDownEvent, new KeyEventHandler(textBox_PreviewKeyDown), true);
            sourceTextBox.AddHandler(TextBox.TextChangedEvent, new TextChangedEventHandler(textBox_TextChanged), true);
        }
예제 #43
0
        protected override void OnGotKeyboardFocus(System.Windows.Input.KeyboardFocusChangedEventArgs e)
        {
            base.OnGotKeyboardFocus(e);
            System.Diagnostics.Trace.WriteLine(string.Format("OnGotKeyboardFocus({0}, {1})", e.Source, e.NewFocus));


            //if (_model.SelectedContent != null)
            //    _model.SelectedContent.IsActive = true;
        }
예제 #44
0
        private void TextBox_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            var textbox = sender as TextBox;

            if (textbox != null)
            {
                textbox.SelectAll();
            }
        }
예제 #45
0
        protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
        {
            if (!(Mouse.LeftButton == MouseButtonState.Pressed && this.IsMouseOver))
            {
                this.onFocusedByTab();
            }

            base.OnGotKeyboardFocus(e);
        }
예제 #46
0
        protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)
        {
            if (this.SelectAllOnKeyboardFocus)
            {
                this.SelectionLength = 0;
            }

            base.OnLostKeyboardFocus(e);
        }
예제 #47
0
 protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
 {
     base.OnGotKeyboardFocus(e);
     var result = OnScreenKeyboardService.GetIntValue();
     if (result != null)
     {
         Text = result.Value.ToString(CultureInfo.CurrentCulture);
     }
 }
예제 #48
0
    protected override void OnPreviewGotKeyboardFocus( KeyboardFocusChangedEventArgs e )
    {
      base.OnPreviewGotKeyboardFocus( e );

      if( this.Child != null )
      {
        CellEditor.SetHasError( ( DependencyObject )this.Child, false );
      }
    }
예제 #49
0
 protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)
 {
     // We could have lost focus because we're already closing, make sure this doesn't call close twice
     if (!_closing)
     {
         Close();
     }
     base.OnLostKeyboardFocus(e);
 }
예제 #50
0
        private void dp_endedatum_GotKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
        {
            DatePickerTextBox dptb_endedatum = (DatePickerTextBox)dp_endedatum.Template.FindName("PART_TextBox", dp_endedatum);

            if (dptb_endedatum != null)
            {
                dptb_endedatum.SelectAll();
            }
        }
예제 #51
0
 // Behaviour: Highlight the border and make the text caret appear whenever the control gets the keyboard focus
 private void ContentControl_GotKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
 {
     this.ContentControl.BorderThickness = new Thickness(Constant.Control.BorderThicknessHighlight);
     this.ContentControl.BorderBrush     = Constant.Control.BorderColorHighlight;
     if (this.ContentControl.Template.FindName("PART_TextBox", this.ContentControl) is Xceed.Wpf.Toolkit.WatermarkTextBox textBox)
     {
         textBox.IsReadOnlyCaretVisible = true;
     }
 }
        protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
        {
            base.OnGotKeyboardFocus(e);

            if (SelectAllOnGotFocus)
                SelectAll();
            else
                SelectionLength = 0;                
        }
예제 #53
0
 private void InputTextBox_GotKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
 {
     if (InputTextBox.Text == "搜索栏")
     {
         InputTextBox.Text = "";
     }
     InputTextBox.SelectAll();
     InputTextBox.Opacity = 1.0;
 }
예제 #54
0
        protected override void OnLostKeyboardFocus(System.Windows.Input.KeyboardFocusChangedEventArgs e)
        {
            base.OnLostKeyboardFocus(e);

            if (!IsMouseOver)
            {
                BorderThickness = new Thickness(0);
                Margin          = new Thickness(2, 2, 10, 2);
            }
        }
        void AssociatedObject_GotKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
        {
            Debug.WriteLine("FocusBorderAdornerBehavior - AssociatedObject_GotKeyboardFocus " + AssociatedObject);

            CreateAdorner();

            if (_adorner != null)
            {
                _adorner.Visibility = Visibility.Visible;
            }
        }
 private void TextBox_LostKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
 {
     if (textbox != null && suggestionsList != null)
     {
         if (suggestionsList.IsKeyboardFocusWithin)
         {
             return;
         }
     }
     ClearSuggestions();
 }
예제 #57
0
 private void textBox_LostKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
 {
     // 按完回车后这里会再调用一次,去掉重复调用
     //EnableEdit = false;
     //BindingExpression be = textBox.GetBindingExpression(TextBox.TextProperty);
     //if(be != null)
     //{
     //    be.UpdateSource();
     //    OnValueManualChanged?.Invoke();
     //}
 }
예제 #58
0
        /// <summary>
        /// Update the text when focus is lost.
        /// </summary>
        /// <param name="e">The event arguments.</param>
        protected override void OnLostKeyboardFocus(System.Windows.Input.KeyboardFocusChangedEventArgs e)
        {
            BindingExpression bindingExpression = this.GetBindingExpression(MaskedTextBox.TextProperty);

            base.OnLostKeyboardFocus(e);

            // For some reason, the selection isn't getting cleared when we lose keyboard focus, so we force it here.
            this.SelectionLength = 0;

            // Make sure the display looks reflects the underlying values.
            bindingExpression.UpdateTarget();
        }
예제 #59
0
        protected override void OnGotKeyboardFocus(System.Windows.Input.KeyboardFocusChangedEventArgs e)
        {
            if (Text.Contains(NumberFormatInfo.CurrentInfo.NumberDecimalSeparator))
            {
                CaretIndex = Text.IndexOf(NumberFormatInfo.CurrentInfo.NumberDecimalSeparator);
            }
            else
            {
                CaretIndex = Text.Length;
            }

            base.OnGotKeyboardFocus(e);
        }
예제 #60
0
 /// <summary>フォーカスロス</summary>
 /// <param name="sender">源</param>
 /// <param name="e">イベント</param>
 private void Window_LostKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
 {
     if (_needFocus)
     {
         this.Focusable = true;
         Keyboard.Focus(this);
         _needFocus = false;
     }
     else
     {
         this.Topmost = false;
     }
 }