This topic explains how to configure the ruler margin feature.
The following topics are prerequisites to understanding this topic:
This topic contains the following sections:
The xamSyntaxEditor™ control supports a ruler margin feature using a red dot to identify the location of the caret along the width of the editing area. When enabled the ruler displays at the top of the editing area regardless of splitting being enabled; however, if splitting is enabled 2 rulers will render, one for each split.
The following screenshot shows the xamSyntaxEditor with ruler margin enabled, and the caret positioned at column 15 (1-based):
The following table lists the configurable aspects of the xamSyntaxEditor’s ruler margin.
Show or hide the ruler margin.
The following code snippet shows how to make the ruler margin visible:
In C#:
this.xamSyntaxEditor1.IsRulerMarginVisible = true;
In Visual Basic:
Me.xamSyntaxEditor1.IsRulerMarginVisible = True
Change the brush used to fill the ruler margin area.
The following code snippet shows how to set the ruler margin’s background to light gray.
In C#:
this.xamSyntaxEditor1.RulerMarginBackground = new SolidColorBrush(Colors.LightGray);
In Visual Basic:
Me.xamSyntaxEditor1.RulerMarginBackground = New SolidColorBrush(Colors.LightGray)
Change the brush used to draw the rectangle surrounding the ruler margin’s area.
The following code snippet shows how to set the ruler margin’s border to dark gray.
In C#:
this.xamSyntaxEditor1.RulerMarginBorderBrush = new SolidColorBrush(Colors.DarkGray);
In Visual Basic:
Me.xamSyntaxEditor1.RulerMarginBorderBrush = New SolidColorBrush(Colors.DarkGray)
Change the brush used to draw the ruler margin tick marks.
The following code snippet shows how to set the ruler margin’s tick marks to black.
In C#:
this.xamSyntaxEditor1.RulerMarginTickMarkBrush = new SolidColorBrush(Colors.Black);
In Visual Basic:
Me.xamSyntaxEditor1.RulerMarginTickMarkBrush = New SolidColorBrush(Colors.Black)
Change the brush used to draw caret position highlight in the ruler margin.
The following code snippet shows how to set the ruler margin’s caret highlight to red.
In C#:
this.xamSyntaxEditor1.RulerMarginCaretPositionHighlightBrush =
new SolidColorBrush(Colors.Red);
In Visual Basic:
Me.xamSyntaxEditor1. RulerMarginCaretPositionHighlightBrush = _
New SolidColorBrush(Colors.Black)
Change the brush used to draw the ruler margin numbers.
The following code snippet shows how to set the ruler margin’s numbers to black.
In C#:
this.xamSyntaxEditor1.RulerMarginTextBrush = new SolidColorBrush(Colors.Black);
In Visual Basic:
Me.xamSyntaxEditor1.RulerMarginTextBrush = New SolidColorBrush(Colors.Black)
The following topics provide additional information related to this topic.