To my big surprise the RichtTextBox
does not return the same value as was set !
Setting a string With:
SelectAll()
RichTextBox.Selection.Text = "AA"
And returning with:
SelectAll()
Return RichTextBox.Selection.Text
Returns "AA" with carriage-return
Also using:
Dim Selection = New TextRange(rtbRichTextBox.Document.ContentStart, rtbRichTextBox.Document.ContentEnd)
Selection.Text = "AA"
And returning with:
Dim Selection = New TextRange(rtbRichTextBox.Document.ContentStart, rtbRichTextBox.Document.ContentEnd)
Return Selection.Text
Does the same: "AA" with carriage-return
The RichTextBox
does not return the value as set
Very incorrect behaviour !!
Is solved (circumvented) this by:
Dim Selection = New TextRange(rtbRichTextBox.Document.ContentStart, rtbRichTextBox.Document.ContentEnd.GetPositionAtOffset(-1))
Return Selection.Text