How to modify the content in Windows Phone RichTextBoxAdv programmatically?
The SfRichTextBoxAdv’s Document Object Model allows you to create and manipulate the document programmatically similar to Microsoft Word automation.
The following code example demonstrates how to define a new document and add text through code behind.
C#
// Defines the document. DocumentAdv documentAdv = new DocumentAdv(); // Defines and adds a section to the document. SectionAdv sectionAdv = new SectionAdv(); // You can add any number of sections here. documentAdv.Sections.Add(sectionAdv); // Defines and adds a paragraph to the section. ParagraphAdv paragraphAdv = new ParagraphAdv(); // You can add any number of paragraphs, tables here. sectionAdv.Blocks.Add(paragraphAdv); // Defines and add a span to the paragraph. SpanAdv spanAdv = new SpanAdv(); spanAdv.Text = "Hello world"; // You can add any number of spans, images and hyperlink fields here. paragraphAdv.Inlines.Add(spanAdv); // Define the document for SfRichTextBoxAdv control. richTextBoxAdv.Document = documentAdv;
VB
' Defines the document. Dim documentAdv As New DocumentAdv() ' Defines and adds a section to the document. Dim sectionAdv As New SectionAdv() ' You can add any number of sections here. documentAdv.Sections.Add(sectionAdv) ' Defines and adds a paragraph to the section. Dim paragraphAdv As New ParagraphAdv() ' You can add any number of paragraphs, tables here. sectionAdv.Blocks.Add(paragraphAdv) ' Defines and add a span to the paragraph. Dim spanAdv As New SpanAdv() spanAdv.Text = "Hello world" ' You can add any number of spans, images and hyperlink fields here. paragraphAdv.Inlines.Add(spanAdv) ' Define the document for SfRichTextBoxAdv control. richTextBoxAdv.Document = documentAdv