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.
Get XAML Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.