ContentEnd Property

RichTextBox.ContentEnd Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets a TextPointer that indicates the end of content in the RichTextBox.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)

public TextPointer ContentEnd { get; }

Property Value

Type: System.Windows.Documents.TextPointer
A TextPointer that indicates the end of content in the RichTextBox.

In an empty RichTextBox (one without blocks), ContentEnd is the same as ContentStart, and both are insertion positions. This is the only instance when ContentStart or ContentEnd is an insertion position.

The following method uses the ContentStart and ContentEnd methods to determine if a RichTextBox is empty.


//This method returns true if the RichTextBox is empty.
public bool isRichTextBoxEmpty()
{
    TextPointer startPointer = MyRTB1.ContentStart.GetNextInsertionPosition(LogicalDirection.Forward);
    TextPointer endPointer = MyRTB1.ContentEnd.GetNextInsertionPosition(LogicalDirection.Backward);
    if (startPointer.CompareTo(endPointer) == 0)
        return true;
    else
        return false;
}


Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone

Show:
© 2017 Microsoft