Jonathan Wood
Jonathan Wood

Reputation: 67195

Reset TextBox Undo/Redo

My program displays a window with a textbox. My code populates the textbox before the dialog is displayed.

I want undo and redo to work normally; however my code's initial population of the textbox should not be an undoable action.

Once the textbox has been populated, how can I clear the Undo/Redo actions?

Unfortunately, I'm very frustrated learning WPF right now and am amazed at the things it either cannot do or can only do by jumping through hoops. So I'm not very optimistic about this simple request but just thought I'd ask.

Upvotes: 1

Views: 1604

Answers (1)

WhoIsRich
WhoIsRich

Reputation: 4163

You can do:

textbox1.Text = "Starting text.";
textbox1.IsUndoEnabled = false;
textbox1.IsUndoEnabled = true;

Upvotes: 10

Related Questions