Text Selection
TextBox exposes straightforward and familiar members for text selection—SelectionHighlightColor, SelectAll, Select, SelectedText, SelectionStart, SelectionLength, and GetRectFromCharacterIndex. However, unlike TextBlock and RichTextBlock, these are based on simple int character indices rather than TextPointer objects.
In addition to the Select All and Copy commands supported by TextBlock and RichTextBlock, TextBox’s editable nature enables it to provide automatic support for Cut, Paste, Undo, and Redo as well. The availability of every command except Select All depends on context, but Figure 12.20 shows the built-in context menu when every command is available.
FIGURE 12.20 TextBox supports all the standard text commands via ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access