Version

Current Line Highlighting (xamSyntaxEditor)

Topic Overview

Purpose

This topic explains the current line highlighting feature.

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.

Introduction

Current line highlighting summary

The current line highlighting feature highlights the line containing the caret. You can specify both the background and border brushes for the current line highlight.

The following screenshot shows the xamSyntaxEditor with the current line highlighting feature enabled:

xamSyntaxEditor CurrentLineHL.png

Feature Configuration Summary

Feature configuration summary chart

The following table lists the xamSyntaxEditor control’s configurable aspects of the current line highlighting feature. Additional information follows the table.

Configurable aspect Details Properties

Show/hide the current line highlighting

Sets the background brush of the current line highlight

Sets the border brush of the current line highlight

Enable/Disable the Current Line Highlighting

Overview

Use the xamSyntaxEditor control’s CurrentLineHighlightVisibility property to enable/disable current line highlighting.

Property settings

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

Enable current line highlighting feature

CurrentLineHighlightVisibility

Visibility.Visible

Disable the current line highlighting feature

CurrentLineHighlightVisibility

Visibility.Collapsed

Code

The following code snippet demonstrates how to enable current line highlighting:

In C#:

this.xamSyntaxEditor1.CurrentLineHighlightVisibility = Visibility.Visible;

In Visual Basic:

Me.xamSyntaxEditor1.CurrentLineHighlightVisibility = Visibility.Visible

Set the Current Line Highlighting Background Brush

Overview

Use the xamSyntaxEditor control’s CurrentLineHighlightBackgroundBrush property to set the brush used to draw the background of the current line highlight.

Property settings

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

Set a brush for drawing the background of the current line highlight

CurrentLineHighlightBackgroundBrush

An object of type Brush

Code

The following code example demonstrates how to set a solid yellow color brush for drawing the background of the current line highlight:

In C#:

this.xamSyntaxEditor1.CurrentLineHighlightBackgroundBrush =
    new SolidColorBrush(Colors.Yellow);

In Visual Basic:

Me.xamSyntaxEditor1.CurrentLineHighlightBackgroundBrush = _
    New SolidColorBrush(Colors.Yellow)

Set the Current Line Highlighting Border Brush

Overview

Use the xamSyntaxEditor control’s CurrentLineHighlightBorderBrush property to set the brush used to draw the border of the current line highlight.

Property settings

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

Set a brush for drawing the border of the current line highlight

CurrentLineHighlightBorderBrush

An object of type Brush

Code

The following code example demonstrates how to set a solid red color brush for drawing the border of the current line highlight:

In C#:

this.xamSyntaxEditor1.CurrentLineHighlightBorderBrush =
    new SolidColorBrush(Colors.Magenta);

In Visual Basic:

Me.xamSyntaxEditor1.CurrentLineHighlightBorderBrush = _
    New SolidColorBrush(Colors.Magenta)

Related Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic provides information on how to change the presention of the document’s content inside the xamSyntaxEditor .

This topic will help you understand the document splitting capability of the xamSyntaxEditor and how to customize it.

This topic provides information about text colorization, based on the TextDocument’s associated language.