RichTextBox (WPF) does not have string property "Text"
There was a confusion between RichTextBox in System.Windows.Forms and in System.Windows.Control
I am using the one in the Control as I am using WPF. In there, there is no Text property, and in order to get a text, I should have used this line:
string myText = new TextRange(transcriberArea.Document.ContentStart, transcriberArea.Document.ContentEnd).Text;
thanks
The WPF RichTextBox has a Document
property for setting the content a la MSDN:
// Create a FlowDocument to contain content for the RichTextBox. FlowDocument myFlowDoc = new FlowDocument(); // Add paragraphs to the FlowDocument. myFlowDoc.Blocks.Add(new Paragraph(new Run("Paragraph 1"))); myFlowDoc.Blocks.Add(new Paragraph(new Run("Paragraph 2"))); myFlowDoc.Blocks.Add(new Paragraph(new Run("Paragraph 3"))); RichTextBox myRichTextBox = new RichTextBox(); // Add initial content to the RichTextBox. myRichTextBox.Document = myFlowDoc;
You can just use the AppendText
method though if that's all you're after.
Hope that helps.