.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
A newer version of this page is available. Switch to the current version.

ParagraphStyle.LinkedStyle Property

Gets or sets the linked style for the current style.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v19.1.Core.dll


CharacterStyle LinkedStyle { get; set; }

Property Value

Type Description

A ParagraphStyle object representing a paragraph style linked to a current style


A linked style can act as a paragraph style or a character style, depending on the range to which it is applied.

If a linked style is applied to a selection which does not include an entire paragraph, the selected text is formatted with the character formatting settings of the linked styles.

If a selection includes an entire paragraph, both character and paragraph formatting settings are applied.

If a selection is just a caret position and contains no characters, the linked style behaves like a paragraph style.

You should specify the LinkedStyle property only once, for one of the linked styles.


Assigning a style via the LinkedStyle property results in overwriting the corresponding settings of the style to which the style becomes linked. So you are advised to link styles first, and specify their settings afterwards.

The following code snippet demonstrates how to create linked styles.

document.AppendText("Line One" & vbLf & "Line Two" & vbLf & "Line Three")

'Create new paragraph style
Dim lstyle As ParagraphStyle = document.ParagraphStyles("MyLinkedStyle")
If lstyle Is Nothing Then
    lstyle = document.ParagraphStyles.CreateNew()
    lstyle.Name = "MyLinkedStyle"
    lstyle.LineSpacingType = ParagraphLineSpacing.Double
    lstyle.Alignment = ParagraphAlignment.Center

    Dim lcstyle As CharacterStyle = document.CharacterStyles.CreateNew()
    lcstyle.Name = "MyLinkedCStyle"
    lcstyle.LinkedStyle = lstyle

    lcstyle.ForeColor = System.Drawing.Color.DarkGreen
    lcstyle.Strikeout = StrikeoutType.Single
    lcstyle.FontSize = 24

    'Apply created styles 
    'to the text range and to the entire paragraph
    document.Paragraphs(1).Style = lstyle

    Dim myRange As DocumentRange = document.Paragraphs(0).Range
    Dim charProps As CharacterProperties = document.BeginUpdateCharacters(myRange)
    charProps.Style = lcstyle
End If
See Also