I want to disable undo redo feature of textbox and richtextbox. Please tell how to do this.
Asked
Active
Viewed 2,720 times
8
-
2Why would you want to do that? – Daniel Hilgarth Jul 18 '11 at 12:05
-
2I can think of a couple really good reasons. 1) memory usage, 2) performance, 3) annoy the users. – GalacticCowboy Jul 18 '11 at 12:17
-
Here's one I'm currently dealing with: disabling redo and undo in MaskedTextBox. It's just too much of a pain to implement (at least in WPF since you basically have to re-implement redo and undo and put the caret back in the right place every time); not worth it at all since they will probably never even get used. I know of 2 reputable sources that disable these functions in their masked textboxes: 1) [jQuery](http://digitalbush.com/projects/masked-input-plugin/), 2) [Syncfusion](http://www.syncfusion.com/prducts/wpf/masked-text-box), also 3) this textbox that I'm typing in (not masked though) – Daniel Ward Jun 10 '14 at 21:53
2 Answers
18
You can use the IsUndoEnabled property:
<TextBox Name="yourTextBox" IsUndoEnabled="False" />

Frédéric Hamidi
- 258,201
- 41
- 486
- 479