Back to Devexpress

SubDocument.ApplySyntaxHighlight(List<SyntaxHighlightToken>) Method

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-subdocument-dot-applysyntaxhighlight-x28-system-dot-collections-dot-generic-dot-list-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-syntaxhighlighttoken-x29.md

latest7.4 KB
Original Source

SubDocument.ApplySyntaxHighlight(List<SyntaxHighlightToken>) Method

Performs a batch update of text formatting for document ranges corresponding to specified tokens.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
void ApplySyntaxHighlight(
    List<SyntaxHighlightToken> tokens
)
vb
Sub ApplySyntaxHighlight(
    tokens As List(Of SyntaxHighlightToken)
)

Parameters

NameTypeDescription
tokensList<SyntaxHighlightToken>

A List<T><SyntaxHighlightToken,> collection containing tokens to apply, ordered by the SyntaxHighlightToken.Start value.

|

Remarks

Call the SubDocument.ApplySyntaxHighlight method within the ISyntaxHighlightService.Execute() method to enable syntax highlighting.

Refer to the How to: Highlight Document Syntax example (or How to: Highlight Document Syntax for WPF) for information on how to obtain the collection of SyntaxHighlightToken objects.

The following code snippets (auto-collected from DevExpress Examples) contain references to the ApplySyntaxHighlight(List<SyntaxHighlightToken>) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-richedit-syntax-highlighting-with-devexpress-codeparser-library/CS/WindowsFormsApplication1/SyntaxHighlighting.cs#L64

csharp
}
    document.ApplySyntaxHighlight(syntaxTokens);
}

syntax-highlighting-for-c-and-vb-code-using-devexpress-codeparser-and-syntax-highlight-tokens/CS/SyntaxHighlightSimple/MainWindow.xaml.cs#L81

csharp
}
document.ApplySyntaxHighlight(syntaxTokens);
document.EndUpdateCharacters(cp);

winforms-richedit-implement-t-sql-language-syntax-highlighting/CS/CustomSyntaxHighlightService.cs#L33

csharp
List<SyntaxHighlightToken> tSqltokens = ParseTokens();
    document.ApplySyntaxHighlight(tSqltokens);
}

wpf-spreadsheet-chart-api/CS/SpreadsheetWPFChartAPISamples/CodeUtils/SyntaxHightlight.cs#L119

csharp
}
document.ApplySyntaxHighlight(syntaxTokens);
document.EndUpdateCharacters(cp);

wpf-spreadsheet-pivot-table-api-examples/CS/SpreadsheetWPFPivotTableExamples/CodeUtils/SyntaxHightlight.cs#L140

csharp
}
document.ApplySyntaxHighlight(syntaxTokens);
document.EndUpdateCharacters(cp);

winforms-richedit-syntax-highlighting-with-devexpress-codeparser-library/VB/WindowsFormsApplication1/SyntaxHighlighting.vb#L65

vb
document.ApplySyntaxHighlight(syntaxTokens)
End Sub

syntax-highlighting-for-c-and-vb-code-using-devexpress-codeparser-and-syntax-highlight-tokens/VB/SyntaxHighlightSimple/MainWindow.xaml.vb#L76

vb
document.ApplySyntaxHighlight(syntaxTokens)
document.EndUpdateCharacters(cp)

winforms-richedit-implement-t-sql-language-syntax-highlighting/VB/CustomSyntaxHighlightService.vb#L33

vb
Dim tSqltokens As List(Of SyntaxHighlightToken) = ParseTokens()
    document.ApplySyntaxHighlight(tSqltokens)
End Sub

wpf-spreadsheet-chart-api/VB/SpreadsheetWPFChartAPISamples/CodeUtils/SyntaxHightlight.vb#L119

vb
Next token
document.ApplySyntaxHighlight(syntaxTokens)
document.EndUpdateCharacters(cp)

wpf-spreadsheet-pivot-table-api-examples/VB/SpreadsheetWPFPivotTableExamples/CodeUtils/SyntaxHightlight.vb#L119

vb
Next token
document.ApplySyntaxHighlight(syntaxTokens)
document.EndUpdateCharacters(cp)

See Also

ISyntaxHighlightService

SyntaxHighlightToken

SubDocument Interface

SubDocument Members

DevExpress.XtraRichEdit.API.Native Namespace