From 7b1a9fbb84e14124a67d54748571344f6db74bc4 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 4 Jun 2020 15:26:10 +0200 Subject: [PATCH] Fix caret not displaying when focused via Tab key. Also set caret position to end when selecting all, as textboxes when selected should scroll to display the end of the text. --- src/Avalonia.Controls/TextBox.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Avalonia.Controls/TextBox.cs b/src/Avalonia.Controls/TextBox.cs index 42e16e6979..c2f496287c 100644 --- a/src/Avalonia.Controls/TextBox.cs +++ b/src/Avalonia.Controls/TextBox.cs @@ -347,7 +347,7 @@ namespace Avalonia.Controls if (IsFocused) { - DecideCaretVisibility(); + _presenter?.ShowCaret(); } } @@ -364,14 +364,7 @@ namespace Avalonia.Controls { SelectAll(); } - else - { - DecideCaretVisibility(); - } - } - private void DecideCaretVisibility() - { _presenter?.ShowCaret(); } @@ -975,6 +968,7 @@ namespace Avalonia.Controls { SelectionStart = 0; SelectionEnd = Text?.Length ?? 0; + CaretIndex = SelectionEnd; } private bool DeleteSelection()