#935 – Setting an Undo Limit for a TextBox
October 24, 2013 Leave a comment
By default, a TextBox control has an undo limit of 100. That is, it keeps track of the most recent 100 edits that you’ve made, allowing you to undo them one at a time.
You can change the number of operations that the TextBox remembers by setting its UndoLimit property. For example, if you set this value to 3, the TextBox will only allow you to undo the most recent three edits.
You may want to increase the value of UndoLimit so that the user of your application has the ability to undo a larger number of recent operations.
<TextBox Margin="5" UndoLimit="1000" Text="{Binding SomeText}" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto"/>
On the other hand, you may want to reduce the value of UndoLimit so that your application does need to allocate memory for all of the recent changes to a TextBox.