Version

Whitespace Highlighting (xamSyntaxEditor)

Topic Overview

Purpose

This topic explains the whitespace 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

Whitespace highlighting summary

The whitespace highlighting feature indicates all of the places within the TextDocument occupied by spaces or tabs by displaying them within the editing area using symbols, colored dots and arrows respectively, thus highlighting their locations; these symbols do not replace the spaces or tabs contained within the document.

The following screenshot shows the xamSyntaxEditor with the whitespace highlighting feature enabled and the drawing brush set as magenta.

xamSyntaxEditor Whitespace Highlighting 1.png

Feature Configuration Summary

Feature configuration summary chart

The following table lists the configurable aspects of the whitespace highlighting feature of the xamSyntaxEditor control. Additional information is available following the table.

Configurable aspect Details Properties

Show/hide the whitespace highlighting

Sets the brush to use for whitespace highlighting

Enable/Disable the Whitespace Highlighting

Overview

Use the xamSyntaxEditor control’s WhitespaceIndicatorVisibility property to enable/disable whitespace highlighting.

Property settings

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

Enable whitespace highlighting feature

WhitespaceIndicatorVisibility

Visibility.Visible

Disable the whitespace highlighting feature

WhitespaceIndicatorVisibility

Visibility.Collapsed

Code

The following code snippet demonstrates how to enable whitespace highlighting:

In C#:

this.xamSyntaxEditor1.WhitespaceIndicatorVisibility = Visibility.Visible;

In Visual Basic:

Me.xamSyntaxEditor1.WhitespaceIndicatorVisibility = Visibility.Visible

Set the Whitespace Highlighting Brush

Overview

Use the xamSyntaxEditor control’s WhitespaceIndicatorBrush property to set the whitespace highlighting brush.

Property settings

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

Set a brush for the whitespace highlighting feature

WhitespaceIndicatorBrush

An object of type Brush

Note
Note

The WhitespaceIndicatorBrush property has higher priority than the foreground brush set in the Whitespace Classification Type. You can also use the WhiteSpaceIndicatorBrushResolved property to obtain the brush used to render the whitespace indicators, which value is determined as follows:

  • If the WhitespaceIndicatorBrush is explicitly set, then its value is returned by the WhitespaceIndicatorBrushResolved property

  • Otherwise, the value of the foreground brush associated with the ClassificationType.Whitespace entry in the XamSyntaxEditor.ClassificationAppearanceMapResolved map is returned.

Code

The following code example demonstrates how to set a solid magenta color brush for whitespace highlighting:

In C#:

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

In Visual Basic:

Me.xamSyntaxEditor1.WhitespaceIndicatorBrush = 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 provides information on how to change the colors and other appearance attributes assigned to language elements by 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.