New to Telerik UI for WinFormsStart a free 30-day trial

RadSyntaxEditor's Properties

Updated over 6 months ago
PropertyDescription
SyntaxEditorElementGets the syntax editor element.
DocumentGets or sets the text document.
TextFormatDefinitionsGets the text format definitions.
InputHandlerGets or sets the component which is responsible for handling the input of RadSyntexEditor.
AllowScalingGets or sets a value indicating whether to allow scaling.
EditorFontSizeGets or sets a value indicating the font size of the text editor.
CaretColorGets or sets the caret color.
CaretDisplayModeGets or sets the caret display mode.
CaretWidthGets or sets the caret width when the DisplayMode is set to Normal.
IsCaretVisibleGets or sets a value indicating whether this instance is caret visible.
DispatcherGets the dispatcher objcect.
CommandsGets the commands available in the control.
ScaleFactorGets or sets the scale factor.
PaletteGets or sets the palette of syntax elements' colors used for the RadSyntaxEditorElement instance.
TaggersRegistryGets the taggers registry.
UseShiftKeyInSelectionGets or sets a value indicating whether using shift key in selection.
IsSelectionEnabledGets or sets a value indicating whether this instance is selection enabled.
ShowLineNumbersGets or sets a value indicating whether the line numbers are shown. (introduced in R1 2021 SP2)
ShouldTaggersProcessEntireLinesGets or sets a value whether the entire line should be processed by the taggers.(introduced in R2 2021)

RadSyntaxEditorElement's Properties

PropertyDescription
EditorFontFamilyGets or sets a value indicating the font family of the text editor.
EditorFontStyleGets or sets a value indicating the font style of the text editor.
EditorFontWeightGets or sets a value indicating the font weight of the text editor.
EditorFontStretchGets or sets a value indicating the font stretch of the text editor.
CaretPositionGets the caret position.
EditorPresenterGets the editor presenter.
FoldingManagerGets the folding manager.
HorizontalScrollBarGets the horizontal scroll bar.
HorizontalScrollBarVisibilityGets or sets the horizontal scroll bar visibility.
VerticalScrollBarVisibilityGets or sets the vertical scroll bar visibility.
IsReadOnlyGets or sets a value indicating whether the syntax editor is read only.
MarginsGets the margins.
SelectionGets the selection.

RadSyntaxEditor's Methods

MethodDescription
CopyCopies this instance.
GetPointFromPositionGets the point from position.
GetPositionFromPointGets the position from point.
MoveCurrentLineToTopMoves the current line to top.
PageDownPages down.
PageUpPages up.
SelectAllSelects all.
UpdateSelectionUpdates the selection.
ZoomInZooms in.
ZoomOutZooms out.
ZoomToZooms to particular zoom level.
GetWordToLeftGets the text within the current word which is to the left of the caret.
GetWordToRightGets the text within the current word which is to the right of the caret.
GetTextGets the text between the specified start and end positions.
DeleteWordToRightDeletes the word to right.
DeleteWordToLeftDeletes the word to left.

As of R1 2021 RadSyntaxEditor offers a new method: GetPositionFromControlPoint. It expects a point relative to the control.

Selecting the word under the mouse on a single click

C#
private void RadSyntaxEditor1_MouseDown(object sender, MouseEventArgs e)
{
    CaretPosition clickPosition = this.radSyntaxEditor1.GetPositionFromControlPoint(e.Location);

    CaretPosition start = new CaretPosition(clickPosition);
    start.MoveToCurrentWordStart();

    CaretPosition end = new CaretPosition(clickPosition);
    end.MoveToCurrentWordEnd();

    this.radSyntaxEditor1.SyntaxEditorElement.CaretPosition.MoveToPosition(end);
    this.radSyntaxEditor1.SyntaxEditorElement.Selection.Select(start, end);
}

RadSyntaxEditor's Events

MethodDescription
CommandErrorOccurs when a command has been canceled due to an error.
CommandExecutedOccurs when a command has been executed.
CommandExecutingOccurs when a command is about to be executed.
DocumentChangedOccurs when the current document has changed.
DocumentChangingOccurs when the current document is about to change.
DocumentContentChangedOccurs when the document's content has changed.
DocumentContentChangingOccurs when the document's content is about to change.
IsReadOnlyChangedOccurs when the IsReadOnly property of the control has changed.
LayoutPropertiesChangedOccurs when one of the layout related properties has changed.
PreviewSyntaxEditorInputOccurs when the control receives keyboard input.
PreviewSyntaxEditorKeyDownOccurs before the KeyDown event when a key is pressed while focus is on this control
PreviewSyntaxEditorKeyUpOccurs before the KeyUp event when a key is pressed while focus is on this control.
PreviewSyntaxEditorMouseLeftButtonDownOccurs when the left mouse button is pressed while the mouse pointer is over the control.
PreviewSyntaxEditorMouseRightButtonDownOccurs when the right mouse button is pressed while the mouse pointer is over the control.
ScaleFactorChangedOccurs when the ScaleFactor of the control changes.
ViewportChangedOccurs when the viewport changes. This can happen when the control is resized, it is scrolled, or if its ScaleFactor changes.
SelectionChangedOccurs when the selection of the control changes.

See Also