diff --git a/src/Avalonia.Controls/TextBox.cs b/src/Avalonia.Controls/TextBox.cs index 42030c2860d..3c221cbf27b 100644 --- a/src/Avalonia.Controls/TextBox.cs +++ b/src/Avalonia.Controls/TextBox.cs @@ -263,7 +263,11 @@ public int SelectionStart 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 @@ public int SelectionEnd set { value = CoerceCaretIndex(value); - SetAndRaise(SelectionEndProperty, ref _selectionEnd, value); + var changed = SetAndRaise(SelectionEndProperty, ref _selectionEnd, value); + if (changed) + { + UpdateCommandStates(); + } if (SelectionStart == SelectionEnd) { CaretIndex = SelectionEnd;