I would like to get the selected text from the rich text box.
When I drag a selection in the ui and then query the selected text I get an empty string:
var thisIsEmpty = rtb.Document.Selection.GetSelectedText()
If I use the Document.CaretPosition to set the selection to the beginning and end of the word, the GetSelectedText() returns that selected word. However, that is just the word under the caret - not necessarily all of the selected words.
text = MainMessageBodyTextBox.Document.Selection.GetSelectedText();
- why is the initial selection empty when dragged from the ui (my document is ReadOnly, but changing that didn't seem to make a difference)
- how can I retrieve all of the selected words from the Selection (the words will be contiguous)