This documentation is archived and is not being maintained.

DocumentAutomationPeer Class

Exposes Document control types to UI Automation.

Namespace:  System.Windows.Automation.Peers
Assembly:  PresentationFramework (in PresentationFramework.dll)

public class DocumentAutomationPeer : ContentTextAutomationPeer
You cannot directly create an instance of this class in XAML.

The DocumentAutomationPeer represents documents and supports the TextPattern. Objects such as a FixedDocument or FlowDocument can contain embedded objects, such as images and hyperlinks. Initially, when you try to get the child elements of the document, DocumentAutomationPeer.GetChildrenCore does not return the embedded objects. To get the embedded elements, obtain a TextPatternRange from the TextPattern and call TextPatternRange.GetChildren. After TextPatternRange.GetChildren is called, any elements in that TextPatternRange are returned by DocumentAutomationPeer.GetChildrenCore.


Unless you know the document is a FlowDocument, you should not call GetChildren on the TextPattern.DocumentRange property. If the document is loaded from a network location, calling GetChildren on the entire document is resource intensive. Instead, you should use one of the methods on TextPattern that returns a TextPatternRange that represents a portion of the document.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0