#935 – Setting an Undo Limit for a TextBox

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.

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: