diff --git a/Perspex.Controls/Presenters/TextPresenter.cs b/Perspex.Controls/Presenters/TextPresenter.cs index 83ee90f3a4..a8c97e5d02 100644 --- a/Perspex.Controls/Presenters/TextPresenter.cs +++ b/Perspex.Controls/Presenters/TextPresenter.cs @@ -13,6 +13,7 @@ namespace Perspex.Controls.Presenters using Perspex.Controls.Primitives; using Perspex.Controls.Utils; using Perspex.Input; + using Perspex.Interactivity; using Perspex.Media; using Perspex.Threading; using Perspex.VisualTree; @@ -99,21 +100,6 @@ namespace Perspex.Controls.Presenters return hit.TextPosition + (hit.IsTrailing ? 1 : 0); } - public new void GotFocus() - { - this.caretBlink = true; - this.caretTimer.Start(); - } - - public new void LostFocus() - { - this.SelectionStart = 0; - this.SelectionEnd = 0; - - this.caretTimer.Stop(); - this.InvalidateVisual(); - } - public override void Render(IDrawingContext context) { var selectionStart = this.SelectionStart; @@ -199,6 +185,25 @@ namespace Perspex.Controls.Presenters } } + protected override void OnGotFocus(RoutedEventArgs e) + { + base.OnGotFocus(e); + + this.caretBlink = true; + this.caretTimer.Start(); + this.InvalidateVisual(); + } + + protected override void OnLostFocus(RoutedEventArgs e) + { + base.OnLostFocus(e); + + this.SelectionStart = 0; + this.SelectionEnd = 0; + this.caretTimer.Stop(); + this.InvalidateVisual(); + } + protected override void OnKeyDown(KeyEventArgs e) { string text = this.Text ?? string.Empty; diff --git a/TestApplication/Program.cs b/TestApplication/Program.cs index 1221d69366..1439dcea72 100644 --- a/TestApplication/Program.cs +++ b/TestApplication/Program.cs @@ -302,7 +302,7 @@ namespace TestApplication }, new TextBox { - Text = "A non-wrapping text box. Lorem ipsum dolor sit amet.", + //Text = "A non-wrapping text box. Lorem ipsum dolor sit amet.", TextWrapping = TextWrapping.NoWrap, }, new TextBox