Is there a way to group or temporarily disable the undo history for a RichTextBox?
If you want to group undo actions (rather than disable undo entirely), you can group a set of programmatic changes via TextBoxBase.BeginChange()
then, after making the changes, TextBoxBase.EndChange()
, i.e.:
richTextBox.BeginChange(); try { // Add column // For each row, add a cell to the column. } finally { richTextBox.EndChange(); }
Or, equivalently, you can call TextBoxBase.DeclareChangeBlock()
inside a using
statement:
using (richTextBox.DeclareChangeBlock()) { // Add column // For each row, add a cell to the column. }
you can disable undo
by setting IsUndoEnabled
property to false
or you can limit the undo by using UndoLimit
. you can disable the undo by setting this property to 0
, ie., UndoLimit="0"
<RichTextBox Name="myRitchTextBox" IsUndoEnabled="False" />