Browse Source
Merge pull request #3572 from Symbai/textboxSelect
Expose TextBox.SelectAll
pull/3575/head
Dariusz Komosiński
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
6 additions and
5 deletions
-
src/Avalonia.Controls/TextBox.cs
|
|
|
@ -316,8 +316,7 @@ namespace Avalonia.Controls |
|
|
|
!AcceptsReturn && |
|
|
|
Text?.Length > 0) |
|
|
|
{ |
|
|
|
SelectionStart = 0; |
|
|
|
SelectionEnd = Text.Length; |
|
|
|
SelectAll(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
@ -673,8 +672,7 @@ namespace Avalonia.Controls |
|
|
|
SelectionEnd = StringUtils.NextWord(text, index); |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
SelectionStart = 0; |
|
|
|
SelectionEnd = text.Length; |
|
|
|
SelectAll(); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -896,7 +894,10 @@ namespace Avalonia.Controls |
|
|
|
CaretIndex = caretIndex; |
|
|
|
} |
|
|
|
|
|
|
|
private void SelectAll() |
|
|
|
/// <summary>
|
|
|
|
/// Select all text in the TextBox
|
|
|
|
/// </summary>
|
|
|
|
public void SelectAll() |
|
|
|
{ |
|
|
|
SelectionStart = 0; |
|
|
|
SelectionEnd = Text?.Length ?? 0; |
|
|
|
|