private void FocusGot() { if (ReadOnly) { return; } if (!HasFocus) { textBeforeCommit = Box.Text; if (ResetTextOnEdit) { Box.Text = string.Empty; } HasFocus = true; Box.BorderColour = BorderFocused; Box.BackgroundColour = backgroundFocused; //set text to current content. InputControl.Text = Box.Text; InputControl.AcceptText = true; //chatWasVisible = ChatEngine.IsVisible; cursor.Transformations.Clear(); cursor.Transformations.Add(new Transformation(TransformationType.Fade, 1, 0.4F, GameBase.Time, GameBase.Time + 1000) { Easing = EasingTypes.Out, Loop = true }); selectionStartLast = -1; //Moved before UpdateCursorPosition to fix cursor mispositioning. Hopefully won't cause any side-effects. OnGotFocus?.Invoke(this, false); UpdateCursorPosition(); updateDisplay(); } }
private void TextBox_GotFocus(object sender, RoutedEventArgs e) { OnGotFocus?.Invoke(this, e); }