Class CharacterFormat
Represents the CharacterFormat class.
Namespace: Syncfusion.Windows.Controls.RichTextBoxAdv
Assembly: Syncfusion.SfRichTextBoxAdv.WPF.dll
Syntax
public sealed class CharacterFormat : BaseNodeConstructors
CharacterFormat()
Initializes a new instance of the CharacterFormat class.
Declaration
public CharacterFormat()CharacterFormat(BaseNode)
Initializes a new instance of the CharacterFormat class for the specified Node.
Declaration
public CharacterFormat(BaseNode owner)Parameters
| Type | Name | Description | 
|---|---|---|
| BaseNode | owner | The owner of the CharacterFormat. The value can be null or an instance of DocumentAdv, ParagraphAdv, Inline or ListLevelAdv. | 
Fields
BaselineAlignmentProperty
Identifies the BaselineAlignment dependency property.
Declaration
public static readonly DependencyProperty BaselineAlignmentPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the BaselineAlignment dependency property. | 
BidiProperty
Identifies the Bidi dependency property.
Declaration
public static readonly DependencyProperty BidiPropertyField Value
| Type | 
|---|
| System.Windows.DependencyProperty | 
BoldProperty
Identifies the Bold dependency property.
Declaration
public static readonly DependencyProperty BoldPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the Bold dependency property. | 
FontColorProperty
Identifies the FontColor dependency property.
Declaration
public static readonly DependencyProperty FontColorPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the FontColor dependency property. | 
FontFamilyProperty
Identifies the FontFamily dependency property.
Declaration
public static readonly DependencyProperty FontFamilyPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the FontFamily dependency property. | 
FontSizeProperty
Identifies the FontSize dependency property.
Declaration
public static readonly DependencyProperty FontSizePropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the FontSize dependency property. | 
HighlightColorProperty
Identifies the HighlightColor dependency property.
Declaration
public static readonly DependencyProperty HighlightColorPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the HighlightColor dependency property. | 
ItalicProperty
Identifies the Italic dependency property.
Declaration
public static readonly DependencyProperty ItalicPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the Italic dependency property. | 
StrikeThroughProperty
Identifies the StrikeThrough dependency property.
Declaration
public static readonly DependencyProperty StrikeThroughPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the StrikeThrough dependency property. | 
UnderlineProperty
Identifies the Underline dependency property.
Declaration
public static readonly DependencyProperty UnderlinePropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the Underline dependency property. | 
Properties
BaselineAlignment
Gets or Sets the BaselineAlignment style.
Declaration
public BaselineAlignment BaselineAlignment { get; set; }Property Value
| Type | Description | 
|---|---|
| BaselineAlignment | The BaselineAlignment style. | 
Examples
The following code example demonstrates how to define the baseline alignment.
<!-- Defines the subscript baseline alignment. --> 
<RichTextBoxAdv:CharacterFormat BaselineAlignment="Subscript"/>//  Defines the subscript baseline alignment.
CharacterFormat characterFormat = new CharacterFormat();
characterFormat.BaselineAlignment = BaselineAlignment.Subscript;' Defines the subscript baseline alignment.
Dim characterFormat As New CharacterFormat()
characterFormat.BaselineAlignment = BaselineAlignment.SubscriptBidi
Gets or sets a value indicating whether the CharacterFormat represents right-to-left reading order. The default value is false.
Declaration
public bool Bidi { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | True. If right-to-left; Otherwise, false. | 
Examples
The following code example demonstrates how to set the right-to-left direction(bidirectional) for span.
<!-- Defines the bidirectional format. --> 
<RichTextBoxAdv:CharacterFormat Bidi="True"/>//  Defines the bidirectional format.
CharacterFormat characterFormat = new CharacterFormat();
characterFormat.Bidi = true;' Defines the bidirectional format.
Dim characterFormat As New CharacterFormat()
characterFormat.Bidi = TrueBold
Gets or sets a value indicating whether the CharacterFormat represents bold.
Declaration
public bool Bold { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | True, if bold. Otherwise False. | 
Examples
The following code example demonstrates how to define the bold format.
<!-- Defines the bold format. --> 
<RichTextBoxAdv:CharacterFormat Bold="True"/>//  Defines the bold format.
CharacterFormat characterFormat = new CharacterFormat();
characterFormat.Bold = true;' Defines the bold format.
Dim characterFormat As New CharacterFormat()
characterFormat.Bold = TrueFontColor
Gets or sets the font color.
Declaration
public Color FontColor { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Windows.Media.Color | The font color. | 
Examples
The following code example demonstrates how to define the color for the font.
<!-- Defines the font color as light green. --> 
<RichTextBoxAdv:CharacterFormat FontColor="#FF90EE90"/>//  Defines the font color as light green.
CharacterFormat characterFormat = new CharacterFormat();
characterFormat.FontColor = Color.FromArgb(0xFF, 0x90, 0xEE, 0x90);' Defines the font color as light green.
Dim characterFormat As New CharacterFormat()
characterFormat.FontColor = Color.FromArgb(&HFF, &H90, &HEE, &H90)FontFamily
Gets or sets the FontFamily.
Declaration
public FontFamily FontFamily { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Windows.Media.FontFamily | The FontFamily. | 
Examples
The following code example demonstrates how to define the font family.
<!-- Defines the font family as Arial. --> 
<RichTextBoxAdv:CharacterFormat FontFamily="Arial"/>//  Defines the font family as Arial.
CharacterFormat characterFormat = new CharacterFormat();
characterFormat.FontFamily = new FontFamily("Arial");' Defines the font family as Arial.
Dim characterFormat As New CharacterFormat()
characterFormat.FontFamily = New FontFamily("Arial")FontSize
Gets or Sets the font size.
Declaration
public double FontSize { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Double | A non-negative value that specifies the font size, measured in pixels. | 
Examples
The following code example demonstrates how to define the size of the font.
<!-- Defines the font size as 24 pixels. --> 
<RichTextBoxAdv:CharacterFormat FontSize="24"/>//  Defines the font size as 24 pixels.
CharacterFormat characterFormat = new CharacterFormat();
characterFormat.FontSize = 24;' Defines the font size as 24 pixels.
Dim characterFormat As New CharacterFormat()
characterFormat.FontSize = 24HighlightColor
Gets or Sets the HighlightColor.
Declaration
public HighlightColor HighlightColor { get; set; }Property Value
| Type | Description | 
|---|---|
| HighlightColor | The HighlightColor. | 
Examples
The following code example demonstrates how to define the hightlight color.
<!-- Defines the highlight color as Yellow. --> 
<RichTextBoxAdv:CharacterFormat HighlightColor="Yellow"/>//  Defines the highlight color as Yellow.
CharacterFormat characterFormat = new CharacterFormat();
characterFormat.HighlightColor = HighlightColor.Yellow;' Defines the highlight color as Yellow.
Dim characterFormat As New CharacterFormat()
characterFormat.HighlightColor = HighlightColor.YellowItalic
Gets or sets a value indicating whether the CharacterFormat represents italic.
Declaration
public bool Italic { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | True, if italic. Otherwise False. | 
Examples
The following code example demonstrates how to define the italic format.
<!-- Defines the italic format. --> 
<RichTextBoxAdv:CharacterFormat Italic="True"/>//  Defines the italic format.
CharacterFormat characterFormat = new CharacterFormat();
characterFormat.Italic = true;' Defines the italic format.
Dim characterFormat As New CharacterFormat()
characterFormat.Italic = TrueShading
Declaration
public Shading Shading { get; set; }Property Value
| Type | 
|---|
| Shading | 
StrikeThrough
Gets or Sets the StrikeThrough style.
Declaration
public StrikeThrough StrikeThrough { get; set; }Property Value
| Type | Description | 
|---|---|
| StrikeThrough | The StrikeThrough. | 
Examples
The following code example demonstrates how to define the strikethrough.
<!-- Defines the single strikethrough. --> 
<RichTextBoxAdv:CharacterFormat StrikeThrough="Single"/>//  Defines the single strikethrough.
CharacterFormat characterFormat = new CharacterFormat();
characterFormat.StrikeThrough = StrikeThrough.Single;' Defines the single strikethrough.
Dim characterFormat As New CharacterFormat()
characterFormat.StrikeThrough = StrikeThrough.SingleStyleName
Declaration
public string StyleName { get; set; }Property Value
| Type | 
|---|
| System.String | 
Underline
Gets or Sets the Underline style.
Declaration
public Underline Underline { get; set; }Property Value
| Type | Description | 
|---|---|
| Underline | The Underline style. | 
Examples
The following code example demonstrates how to define the underline.
<!-- Defines the single underline. --> 
<RichTextBoxAdv:CharacterFormat Underline="Single"/>//  Defines the single underline.
CharacterFormat characterFormat = new CharacterFormat();
characterFormat.Underline = Underline.Single;' Defines the single underline.
Dim characterFormat As New CharacterFormat()
characterFormat.Underline = Underline.Single