The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
TextPointerContext Enumeration
Visual Studio 2010
Determines the category of content that is adjacent to a TextPointer in a specified LogicalDirection.
Assembly: PresentationFramework (in PresentationFramework.dll)
| Member name | Description | |
|---|---|---|
| None | The TextPointer is adjacent to the beginning or end of content. | |
| Text | The TextPointer is adjacent to text. | |
| EmbeddedElement | The TextPointer is adjacent to an embedded UIElement or ContentElement. | |
| ElementStart | The TextPointer is adjacent to the opening tag of a TextElement. | |
| ElementEnd | The TextPointer is adjacent to the closing tag of a TextElement. |
' This method will extract and return a string that contains a representation of ' the XAML structure of content elements in a given TextElement. Private Function GetXaml_Renamed(ByVal element As TextElement) As String Dim buffer As New StringBuilder() ' Position a "navigator" pointer before the opening tag of the element. Dim navigator As TextPointer = element.ElementStart Do While navigator.CompareTo(element.ElementEnd) < 0 Select Case navigator.GetPointerContext(LogicalDirection.Forward) Case TextPointerContext.ElementStart ' Output opening tag of a TextElement buffer.AppendFormat("<{0}>", navigator.GetAdjacentElement(LogicalDirection.Forward).GetType().Name) Case TextPointerContext.ElementEnd ' Output closing tag of a TextElement buffer.AppendFormat("</{0}>", navigator.GetAdjacentElement(LogicalDirection.Forward).GetType().Name) Case TextPointerContext.EmbeddedElement ' Output simple tag for embedded element buffer.AppendFormat("<{0}/>", navigator.GetAdjacentElement(LogicalDirection.Forward).GetType().Name) Case TextPointerContext.Text ' Output the text content of this text run buffer.Append(navigator.GetTextInRun(LogicalDirection.Forward)) End Select ' Advance the naviagtor to the next context position. navigator = navigator.GetNextContextPosition(LogicalDirection.Forward) Loop ' End while. Return buffer.ToString() End Function ' End GetXaml method.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Community Additions
Show: