Browse Source
Merge pull request #5935 from DmitryZhelnin/fixes/5924-copy-from-readonly-textbox
TextBox: update command states on selection changes
pull/5955/head
Max Katz
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
10 additions and
2 deletions
-
src/Avalonia.Controls/TextBox.cs
|
|
|
@ -263,7 +263,11 @@ namespace Avalonia.Controls |
|
|
|
set |
|
|
|
{ |
|
|
|
value = CoerceCaretIndex(value); |
|
|
|
SetAndRaise(SelectionStartProperty, ref _selectionStart, value); |
|
|
|
var changed = SetAndRaise(SelectionStartProperty, ref _selectionStart, value); |
|
|
|
if (changed) |
|
|
|
{ |
|
|
|
UpdateCommandStates(); |
|
|
|
} |
|
|
|
if (SelectionStart == SelectionEnd) |
|
|
|
{ |
|
|
|
CaretIndex = SelectionStart; |
|
|
|
@ -281,7 +285,11 @@ namespace Avalonia.Controls |
|
|
|
set |
|
|
|
{ |
|
|
|
value = CoerceCaretIndex(value); |
|
|
|
SetAndRaise(SelectionEndProperty, ref _selectionEnd, value); |
|
|
|
var changed = SetAndRaise(SelectionEndProperty, ref _selectionEnd, value); |
|
|
|
if (changed) |
|
|
|
{ |
|
|
|
UpdateCommandStates(); |
|
|
|
} |
|
|
|
if (SelectionStart == SelectionEnd) |
|
|
|
{ |
|
|
|
CaretIndex = SelectionEnd; |
|
|
|
|