#934 – TextBox Has Built-In Undo Functionality

The TextBox control in WPF has built-in Undo and Redo functionality, allowing you to undo changes to the content of the TextBox or to re-apply (redo) changes that you’ve undone.

Assume that you have a TextBox with some text:

934-001

Now assume that you double-click to select the first word and then press Delete to delete it.

934-002

Do this two more times, so that you’ve delete the first three words of the text, one at a time.

934-003

You’ve now made three distinct changes to the text in the TextBox, one at a time.  You can delete the most recent change by pressing Ctrl+Z, which executes an undo operation.  This will restore the word that was most recently deleted.

934-004

You can press Ctrl+Z two more times, restoring the other words that you deleted.

934-005

You can redo a change (e.g. delete a word) by pressing Ctrl+Y.

934-006

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a comment