1

I am developing Windows Store App. I used a RichTextBox but could not get text from it, I've searched in internet an tried with TextRange, FlowDocument etc. But none of its working. Any idea how to get text form RichTextBox on a submit button click?

Rashad
  • 11,057
  • 4
  • 45
  • 73

2 Answers2

1

According to MSDN, RichTextBox.Document property gets an object that enables access to the text contained in the RichEditBox.

It returns a ITextDocument which have a GetText property.

To get the text, you would have to do:

var text = String.Empty;
richTextBox.Document.GetText(TextGetOptions.None, out text);
Antoine C.
  • 3,730
  • 5
  • 32
  • 56
0

Get the full plain text of a FlowDocument hosted in a WPF-RichTextBox:

string fullPlainText = new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd).Text;
Pollitzer
  • 1,580
  • 3
  • 18
  • 28