Browse Source

TextBox: update command states on selection changes

pull/5935/head
Dmitry Zhelnin 5 years ago
parent
commit
fd656d29d8
  1. 12
      src/Avalonia.Controls/TextBox.cs

12
src/Avalonia.Controls/TextBox.cs

@ -260,7 +260,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;
@ -278,7 +282,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;

Loading…
Cancel
Save