Version

Supported Languages (xamSyntaxEditor)

Topic Overview

Purpose

This topic lists the languages supported by the xamSyntaxEditor™ and shows you how to use each of them.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

In this topic, you will find information to help you better understand the xamSyntaxEditor’s functions.

This topic covers the text editing capabilities of the xamSyntaxEditor control from both the developer and user’s perspective.

Supported Languages

Supported languages summary chart

The xamSyntaxEditor supports several predefined syntax highlighting languages. Additional information on using supported languages follows.

Note
Note

Certain languages (for example, Visual Basic) modify the case of keywords within a document. To ensure that these modifications are intentionally made to documents containing text targeting a different language, set the document’s language prior to loading the document content.

Language Colorization Details

No special colorization used.

Uses the C# language colorization scheme, which is similar to MS Visual Studio.

Uses the Visual Basic language colorization scheme, which is similar to MS Visual Studio.

Uses the Transact-SQL (T-SQL) language colorization scheme, which is similar to MS Visual Studio.

Note
Note

The internal grammatical structure of these languages, including the structure of the syntax tree created for documents parsed with them, is subject to change. With this in mind, if you are writing code to inspect or traverse a syntax tree you should use the nested SymbolNames class constants in each language definition to identify the name of each node’s symbol (rather than the symbol name as a string literal), so that future changes to these symbol names will be highlighted via compilation errors. In addition, it is good practice to write logic to test assumptions and debug assert about the number and type of child nodes on a particular node so changes to a node’s child structure in the future will be detected and handled gracefully.

Plain Text

Overview

Uses no special colorization.

Property settings

In order to: Use this property: And set it to either:

Set plain text language

C# Language

Overview

Uses the C# language colorization scheme, which is similar to MS Visual Studio.

Property settings

In order to: Use this property: And set it to either:

Set C# language

Language

Visual Basic Language

Overview

Uses the Visual Basic language colorization scheme, which is similar to MS Visual Studio.

Property settings

In order to: Use this property: And set it to either:

Set Visual Basic language

Language

Transact-SQL Language

Overview

Uses the Transact-SQL (TSQL) language colorization scheme, which is similar to MS Visual Studio.

Property settings

In order to: Use this property: And set it to either:

Set Transact-SQL language

Language

Code Examples

Code examples summary

The following table lists the code examples included in this topic.

Example Description

This example shows how to set the TextDocument’s language to plain text.

This example shows how to set the TextDocument’s language to C#.

This example shows how to set the TextDocument’s language to Visual Basic.

This example shows how to set the TextDocument’s language to Transact-SQL.

Code Example: Setting Plain Text Language

Description

This example shows how to set the TextDocument’s language to plain text.

Code snippets

In XAML:

<ig:XamSyntaxEditor x:Name="xamSyntaxEditor1">
    <ig:XamSyntaxEditor.Document>
        <ig:TextDocument>
            <ig:TextDocument.Language>
                <ig:PlainTextLanguage />
            </ig:TextDocument.Language>
        </ig:TextDocument>
    </ig:XamSyntaxEditor.Document>
</ig:XamSyntaxEditor>

In C#:

using Infragistics.Controls.Editors;
using Infragistics.Documents;
using Infragistics.Documents.Parsing;
XamSyntaxEditor xamSyntaxEditor1 = new XamSyntaxEditor();
xamSyntaxEditor1.Document = new TextDocument();
xamSyntaxEditor1.Document.Language = PlainTextLanguage.Instance;

In Visual Basic:

Imports Infragistics.Controls.Editors
Imports Infragistics.Documents
Imports Infragistics.Documents.Parsing
Dim xamSyntaxEditor1 As New XamSyntaxEditor()
xamSyntaxEditor1.Document = New TextDocument()
xamSyntaxEditor1.Document.Language = PlainTextLanguage.Instance

Code Example: Setting C# Language

Description

This example shows how to set the TextDocument’s language to C#.

Code snippets

In XAML:

<ig:XamSyntaxEditor x:Name="xamSyntaxEditor1">
    <ig:XamSyntaxEditor.Document>
        <ig:TextDocument>
            <ig:TextDocument.Language>
                <ig:CSharpLanguage />
            </ig:TextDocument.Language>
        </ig:TextDocument>
    </ig:XamSyntaxEditor.Document>
</ig:XamSyntaxEditor>

In C#:

using Infragistics.Controls.Editors;
using Infragistics.Documents;
using Infragistics.Documents.Parsing;
XamSyntaxEditor xamSyntaxEditor1 = new XamSyntaxEditor();
xamSyntaxEditor1.Document = new TextDocument();
xamSyntaxEditor1.Document.Language = CSharpLanguage.Instance;

In Visual Basic:

Imports Infragistics.Controls.Editors
Imports Infragistics.Documents
Imports Infragistics.Documents.Parsing
Dim xamSyntaxEditor1 As New XamSyntaxEditor()
xamSyntaxEditor1.Document = New TextDocument()
xamSyntaxEditor1.Document.Language = CSharpLanguage.Instance

Code Example: Setting Visual Basic Language

Description

This example shows how to set the TextDocument’s language to Visual Basic.

Code snippets

In XAML:

<ig:XamSyntaxEditor x:Name="xamSyntaxEditor1">
    <ig:XamSyntaxEditor.Document>
        <ig:TextDocument>
            <ig:TextDocument.Language>
                <ig:VisualBasicLanguage />
            </ig:TextDocument.Language>
        </ig:TextDocument>
    </ig:XamSyntaxEditor.Document>
</ig:XamSyntaxEditor>

In C#:

using Infragistics.Controls.Editors;
using Infragistics.Documents;
using Infragistics.Documents.Parsing;
XamSyntaxEditor xamSyntaxEditor1 = new XamSyntaxEditor();
xamSyntaxEditor1.Document = new TextDocument();
xamSyntaxEditor1.Document.Language = VisualBasicLanguage.Instance;

In Visual Basic:

Imports Infragistics.Controls.Editors
Imports Infragistics.Documents
Imports Infragistics.Documents.Parsing
Dim xamSyntaxEditor1 As New XamSyntaxEditor()
xamSyntaxEditor1.Document = New TextDocument()
xamSyntaxEditor1.Document.Language = VisualBasicLanguage.Instance

Code Example: Setting Transact-SQL Language

Description

This example shows how to set the TextDocument’s language to Transact-SQL.

Code snippets

In XAML:

<ig:XamSyntaxEditor x:Name="xamSyntaxEditor1">
    <ig:XamSyntaxEditor.Document>
        <ig:TextDocument>
            <ig:TextDocument.Language>
                <ig:TSqlLanguage />
            </ig:TextDocument.Language>
        </ig:TextDocument>
    </ig:XamSyntaxEditor.Document>
</ig:XamSyntaxEditor>

In C#:

using Infragistics.Controls.Editors;
using Infragistics.Documents;
using Infragistics.Documents.Parsing;
XamSyntaxEditor xamSyntaxEditor1 = new XamSyntaxEditor();
xamSyntaxEditor1.Document = new TextDocument();
xamSyntaxEditor1.Document.Language = TSqlLanguage.Instance;

In Visual Basic:

Imports Infragistics.Controls.Editors
Imports Infragistics.Documents
Imports Infragistics.Documents.Parsing
Dim xamSyntaxEditor1 As New XamSyntaxEditor()
xamSyntaxEditor1.Document = New TextDocument()
xamSyntaxEditor1.Document.Language = TSqlLanguage.Instance

Related Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic provides information on how to change the colors and other appearance attributes assigned to language elements by the xamSyntaxEditor .