Version

Adding xamSyntaxEditor to Your Page

Topic Overview

Purpose

This topic provides you with systematic instructions designed to help you get the xamSyntaxEditor™ up and running as quickly as possible.

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.

In this topic

This topic contains the following sections:

Adding xamSyntaxEditor to Your Page

Introduction

This procedure provides systematic instructions for adding the xamSyntaxEditor to your page.

Preview

The following screenshot illustrates a xamSyntaxEditor with the text, “Hello, World!”. This is representative of how the xamSyntaxEditor previews the result.

xamSyntaxEditor Adding.png

Steps

The following steps demonstrate how to add the xamSyntaxEditor to your page.

1. NuGet package references

Add the following NuGet package reference to your project:

  • Infragistics.WPF.SyntaxEditor

For more information on setting up the NuGet feed and adding NuGet packages, you can take a look at the following documentation: NuGet Feeds.

2. Namespaces

Add the following namespaces:

In XAML:

xmlns:ig="http://schemas.infragistics.com/xaml"

In C#:

using Infragistics.Controls.Editors;
using Infragistics.Documents;

In Visual Basic:

Imports Infragistics.Controls.Editors
Imports Infragistics.Documents

3. Create xamSyntaxEditor

Create and put the xamSyntaxEditor on your page.

In XAML:

<ig:XamSyntaxEditor x:Name="xamSyntaxEditor1">
</ig:XamSyntaxEditor>

4. Create TextDocument

Create the TextDocument and set it to the xamSyntaxEditor ’s “Document” property.

In XAML:

<ig:XamSyntaxEditor.Document>
  <ig:TextDocument />
</ig:XamSyntaxEditor.Document>

In C#:

TextDocument td = new TextDocument();
this.xamSyntaxEditor1.Document = td;

In Visual Basic:

Dim td As New TextDocument()
Me.xamSyntaxEditor1.Document = td

5. Add some text

Using the InitializeText method, add some text in the TextDocument.

In C#:

td.InitializeText("Hello, World!");

In Visual Basic:

td.InitializeText("Hello, World!")

Related Content

Topics

The following topics provide additional information related to this topic.

Topic Purpose

This section is a gateway to important conceptual and task-based information that will help you use various functions and features provided by the xamSyntaxEditor cross platform control.