From 8ed27724793cd7315c9fd2cd73f804a9429ab1ae Mon Sep 17 00:00:00 2001 From: Deadpikle Date: Mon, 7 Jun 2021 07:56:35 -0400 Subject: [PATCH] Fix not raising property change on UndoLimit --- src/Avalonia.Controls/TextBox.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/TextBox.cs b/src/Avalonia.Controls/TextBox.cs index 351d648afc..1bee15bccd 100644 --- a/src/Avalonia.Controls/TextBox.cs +++ b/src/Avalonia.Controls/TextBox.cs @@ -472,7 +472,15 @@ namespace Avalonia.Controls get { return _undoRedoHelper.Limit; } set { - _undoRedoHelper.Limit = value; + if (_undoRedoHelper.Limit != value) + { + // can't use SetAndRaise due to using _undoRedoHelper.Limit + // (can't send a ref of a property to SetAndRaise), + // so use RaisePropertyChanged instead. + var oldValue = _undoRedoHelper.Limit; + _undoRedoHelper.Limit = value; + RaisePropertyChanged(UndoLimitProperty, oldValue, value); + } // from docs at // https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.primitives.textboxbase.isundoenabled: // "Setting UndoLimit clears the undo queue."