Text Formatting Using SpanAdv in WPF RichTextBoxAdv (Classic)

5 May 20212 minutes to read

As Inline will be the content property of ParagraphAdv, SpanAdv can be added only inside the ParagraphAdv. Every ParagraphAdv can keep n number of inline elements inside it. It allows you to display the formatted text using advanced features like font size, font family, strikethrough, and baseline.


Property Description Type Data Type
Text Contains the text information. Dependency Property String
Baseline Indicates whether the inline’s text is subscript or superscript. Dependency Property Baseline
FontFamily Specifies the font family of the text. Dependency Property FontFamily
FontSize Specifies the size of the font. Dependency Property. Double
Foreground Designates the font color. Dependency Property Color
HighlightColor Designates the highlight color of the text. Dependency Property Color
Strikethrough Shows whether the text has SingleStrikeThrough or DoubleStrikeThrough. Dependency Property StrikeThrough
FontWeight Indicates the font weight of the text. Dependency Property FontWeight
Underline Indicates whether the text should be underlined. Dependency Property Underline

Adding SpanAdv to an Application

SpanAdv can be added directly to an application using the following code snippet:

<syncfusion:RichTextBoxAdv Height="300" Width="400" x:Name="richtext">            
 <syncfusion:SpanAdv Text="This is Span text"/>                   
RichTextBoxAdv richtext = new RichTextBoxAdv();          
 DocumentAdv document = new DocumentAdv();           
 SectionAdv section = new SectionAdv();           
 ParagraphAdv paragraph = new ParagraphAdv();           
 SpanAdv span = new SpanAdv();           
 span.Text = "This is span text";           
 richtext.Document = document;