TX Text Control .NET for WPF

AddUndoUnit Method

Method|Introduced in 32.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WPF.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

Description

Adds the current state of the header or footer to the undo stack. Programmatic changes performed with the header's or footer's properties and methods are not automatically added to a TextControl's undo stack. Calling this method is not necessary, when the header's or footer's text and/or formatting is changed.

Syntax

public void AddUndoUnit();

Examples

The following example creates a header for the first section and configures its content or layout by using HeaderFooter.AddUndoUnit.

HeaderFooterCollection headers = textControl.Sections[1].HeadersAndFooters;
headers.Add(HeaderFooterType.Header);
HeaderFooter headerFooter = headers.GetItem(HeaderFooterType.Header);
headerFooter.Selection.Text = "Quarterly report";

headerFooter.AddUndoUnit();
Console.WriteLine("Header Footer is ready for use.");