Class RadSyntaxEditor
A control for editing source code with syntax highlighting and advanced text editing capabilities.
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.SyntaxEditor.dll
Syntax
[TelerikToolboxCategory("Editors")]
public class RadSyntaxEditor : RadControl, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IPCHost, IAnalyticsProvider
Constructors
RadSyntaxEditor()
Declaration
public RadSyntaxEditor()
Properties
AllowScaling
Gets or sets a value indicating whether text scaling is allowed in the editor.
Declaration
public bool AllowScaling { get; set; }
Property Value
System.Boolean
|
AutoSize
This property/method/event is not relevant for this class.
Declaration
public override bool AutoSize { get; set; }
Property Value
System.Boolean
|
Overrides
CaretColor
Gets or sets the color of the text cursor (caret) in the editor.
Declaration
public Color CaretColor { get; set; }
Property Value
System.Drawing.Color
|
CaretDisplayMode
Gets or sets the display mode of the text cursor (caret), determining its appearance in the editor.
Declaration
public CaretDisplayMode CaretDisplayMode { get; set; }
Property Value
CaretDisplayMode
|
CaretWidth
Gets or sets the width of the text cursor (caret) when the CaretDisplayMode is set to Normal.
Declaration
public double CaretWidth { get; set; }
Property Value
System.Double
|
Commands
Gets the collection of commands that can be executed in the syntax editor.
Declaration
public SyntaxEditorCommands Commands { get; }
Property Value
SyntaxEditorCommands
|
DefaultSize
Gets the default size of the control when it is initially placed on a design surface.
Declaration
protected override Size DefaultSize { get; }
Property Value
System.Drawing.Size
A System.Drawing.Size object representing the default size of the control. |
Dispatcher
Gets the dispatcher object that manages the execution of operations on the UI thread.
Declaration
public Dispatcher Dispatcher { get; }
Property Value
Dispatcher
|
Document
Gets or sets the text document that contains the content displayed and edited in the control.
Declaration
public TextDocument Document { get; set; }
Property Value
TextDocument
|
EditorFontSize
Gets or sets the font size of the text displayed in the editor.
Declaration
public double EditorFontSize { get; set; }
Property Value
System.Double
|
InputHandler
Gets or sets the component which is responsible for handling the keyboard and mouse input of the RadSyntaxEditor.
Declaration
public SyntaxEditorInputBehavior InputHandler { get; set; }
Property Value
SyntaxEditorInputBehavior
|
IsCaretVisible
Gets or sets a value indicating whether the text cursor (caret) is visible in the editor.
Declaration
public bool IsCaretVisible { get; set; }
Property Value
System.Boolean
|
IsSelectionEnabled
Gets or sets a value indicating whether text selection is enabled in the editor.
Declaration
public bool IsSelectionEnabled { get; set; }
Property Value
System.Boolean
|
IsWordWrapEnabled
Gets or sets a value indicating whether word wrapping is enabled in the editor.
Declaration
public bool IsWordWrapEnabled { get; set; }
Property Value
System.Boolean
|
Palette
Gets or sets the color palette that defines the appearance of syntax elements in the editor.
Declaration
public SyntaxEditorPalette Palette { get; set; }
Property Value
SyntaxEditorPalette
|
ScaleFactor
Gets or sets the scale factor that determines the size of text and UI elements in the editor.
Declaration
public double ScaleFactor { get; set; }
Property Value
System.Double
|
ShouldTaggersProcessEntireLines
Gets or sets a value indicating whether the entire line should be processed by the syntax taggers instead of just the modified region.
Declaration
public bool ShouldTaggersProcessEntireLines { get; set; }
Property Value
System.Boolean
|
ShowLineNumbers
Gets or sets a value indicating whether the line numbers are shown.
Declaration
public bool ShowLineNumbers { get; set; }
Property Value
System.Boolean
|
SyntaxEditorElement
Gets the RadSyntaxEditorElement which is the main element in the control.
Declaration
public RadSyntaxEditorElement SyntaxEditorElement { get; }
Property Value
RadSyntaxEditorElement
|
TaggersRegistry
Gets the registry of taggers that provide syntax highlighting and other text analysis features.
Declaration
public TaggersRegistry TaggersRegistry { get; }
Property Value
TaggersRegistry
|
TextFormatDefinitions
Gets the stack of text format definitions that determine how different elements of text are displayed.
Declaration
public TextFormatDefinitionStack TextFormatDefinitions { get; }
Property Value
TextFormatDefinitionStack
|
UseShiftKeyInSelection
Gets or sets a value indicating whether the Shift key must be used to extend text selection.
Declaration
public bool UseShiftKeyInSelection { get; set; }
Property Value
System.Boolean
|
Methods
Copy()
Copies the current text selection to the clipboard.
Declaration
public void Copy()
CreateAccessibilityInstance()
Creates the accessibility object for this control to support screen readers and other assistive technologies.
Declaration
protected override AccessibleObject CreateAccessibilityInstance()
Returns
System.Windows.Forms.AccessibleObject
An System.Windows.Forms.AccessibleObject that represents the control for accessibility purposes. |
CreateBehavior()
Creates the input behavior component for the RadSyntaxEditor.
Declaration
protected override ComponentInputBehavior CreateBehavior()
Returns
ComponentInputBehavior
A new instance of RadSyntaxEditorComponentInputBehavior for handling input in this control. |
Overrides
CreateChildItems(RadElement)
Creates the child elements of the RadSyntaxEditor control.
Declaration
protected override void CreateChildItems(RadElement parent)
Parameters
RadElement
parent
The parent element to which child elements will be added. |
Overrides
GetPointFromPosition(CaretPosition)
Converts a text caret position to a point in the editor's coordinate system.
Declaration
public Point GetPointFromPosition(CaretPosition position)
Parameters
CaretPosition
position
The caret position to convert. |
Returns
Point
A Point representing the visual position of the caret. |
GetPositionFromControlPoint(Point)
Converts a point in the control's coordinate system to a text caret position.
Declaration
public CaretPosition GetPositionFromControlPoint(Point point)
Parameters
System.Drawing.Point
point
The point relative to the control's top-left corner. |
Returns
CaretPosition
A CaretPosition representing the text position at the specified point. |
GetPositionFromPoint(Point)
This property/method/event is not relevant for this class.
Declaration
public CaretPosition GetPositionFromPoint(Point point)
Parameters
System.Drawing.Point
point
The point relative to the editor presenter. |
Returns
CaretPosition
A CaretPosition representing the text position at the specified point. |
IsInputKey(Keys)
Determines whether a key should be processed as an input key or passed to the parent control.
Declaration
protected override bool IsInputKey(Keys keyData)
Parameters
System.Windows.Forms.Keys
keyData
The key to check. |
Returns
System.Boolean
|
Overrides
MoveCurrentLineToTop()
Scrolls the editor to position the current line at the top of the viewport.
Declaration
public void MoveCurrentLineToTop()
OnGotFocus(EventArgs)
Handles the event that occurs when the control gets focus, showing the text cursor and focusing the editor element.
Declaration
protected override void OnGotFocus(EventArgs e)
Parameters
System.EventArgs
e
An System.EventArgs object containing event data. |
Overrides
OnKeyDown(KeyEventArgs)
Handles the key down event by delegating it to the input handler.
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
System.Windows.Forms.KeyEventArgs
e
The event data containing information about the key. |
Overrides
OnKeyPress(KeyPressEventArgs)
Handles the key press event by delegating it to the input handler.
Declaration
protected override void OnKeyPress(KeyPressEventArgs e)
Parameters
System.Windows.Forms.KeyPressEventArgs
e
The event data containing information about the pressed key. |
Overrides
OnKeyUp(KeyEventArgs)
Handles the key up event by delegating it to the input handler.
Declaration
protected override void OnKeyUp(KeyEventArgs e)
Parameters
System.Windows.Forms.KeyEventArgs
e
The event data containing information about the released key. |
Overrides
OnLoad(Size)
Called when the control is loaded to initialize the editor element.
Declaration
protected override void OnLoad(Size desiredSize)
Parameters
System.Drawing.Size
desiredSize
The desired size of the control. |
Overrides
OnLostFocus(EventArgs)
Handles the event that occurs when the control loses focus, hiding the text cursor.
Declaration
protected override void OnLostFocus(EventArgs e)
Parameters
System.EventArgs
e
An System.EventArgs object containing event data. |
Overrides
OnThemeChanged()
Called when the control's theme changes to update visual elements accordingly.
Declaration
protected override void OnThemeChanged()
Overrides
PageDown()
Scrolls the editor content down by one page (viewport height).
Declaration
public void PageDown()
PageUp()
Scrolls the editor content up by one page (viewport height).
Declaration
public void PageUp()
ProcessDialogChar(Char)
Processes a dialog character, allowing Alt key combinations to be handled by dialogs.
Declaration
protected override bool ProcessDialogChar(char charCode)
Parameters
System.Char
charCode
The character to process. |
Returns
System.Boolean
|
ProcessMnemonic(Char)
Processes a mnemonic character, which the editor does not support.
Declaration
protected override bool ProcessMnemonic(char charCode)
Parameters
System.Char
charCode
The character to process. |
Returns
System.Boolean
Always |
Overrides
ScaleControl(SizeF, BoundsSpecified)
Scales the control and its child elements according to the specified scaling factor.
Declaration
protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
Parameters
System.Drawing.SizeF
factor
The scaling factor to apply. |
System.Windows.Forms.BoundsSpecified
specified
A value indicating which bounds of the control to scale. |
Overrides
SelectAll()
Selects all text in the editor.
Declaration
public void SelectAll()
UpdateSelection()
Refreshes the visual representation of the current text selection in the editor.
Declaration
public void UpdateSelection()
ZoomIn()
Increases the zoom level (scale factor) of the editor by one step.
Declaration
public void ZoomIn()
ZoomOut()
Decreases the zoom level (scale factor) of the editor by one step.
Declaration
public void ZoomOut()
ZoomTo(Double)
Sets the editor to a specific zoom level (scale factor). The minimum supported zoom level is 0.2 and the maximum supported is 4.
Declaration
public void ZoomTo(double zoomLevel)
Parameters
System.Double
zoomLevel
The scale factor to be applied to the editor content. |
Exceptions
System.ArgumentOutOfRangeException
Thrown when the zoomLevel parameter is negative. |
Events
CommandError
Occurs when a command execution results in an error.
Declaration
public event EventHandler<CommandErrorEventArgs> CommandError
Event Type
System.EventHandler<CommandErrorEventArgs>
|
CommandExecuted
Occurs after a command has been successfully executed.
Declaration
public event EventHandler<CommandExecutedEventArgs> CommandExecuted
Event Type
System.EventHandler<CommandExecutedEventArgs>
|
CommandExecuting
Occurs before a command is executed, allowing you to cancel or modify the command execution.
Declaration
public event EventHandler<CommandExecutingEventArgs> CommandExecuting
Event Type
System.EventHandler<CommandExecutingEventArgs>
|
DocumentChanged
Occurs after the document has been changed, such as when a new document is loaded or created.
Declaration
public event EventHandler DocumentChanged
Event Type
System.EventHandler
|
DocumentChanging
Occurs before the document is changed, allowing you to perform actions before a new document is loaded.
Declaration
public event EventHandler DocumentChanging
Event Type
System.EventHandler
|
DocumentContentChanged
Occurs after the text content of the document has been modified, providing information about the changes made.
Declaration
public event EventHandler<TextContentChangedEventArgs> DocumentContentChanged
Event Type
System.EventHandler<TextContentChangedEventArgs>
|
DocumentContentChanging
Occurs before the text content of the document is modified, allowing you to cancel or modify the changes.
Declaration
public event EventHandler<TextContentChangingEventArgs> DocumentContentChanging
Event Type
System.EventHandler<TextContentChangingEventArgs>
|
IsReadOnlyChanged
Occurs when the read-only state of the editor changes.
Declaration
public event EventHandler IsReadOnlyChanged
Event Type
System.EventHandler
|
LayoutPropertiesChanged
Occurs when the layout properties of the editor change, affecting how text is displayed.
Declaration
public event EventHandler LayoutPropertiesChanged
Event Type
System.EventHandler
|
PreviewSyntaxEditorInput
Occurs before text input is processed by the syntax editor, allowing you to intercept and modify the input.
Declaration
public event EventHandler<PreviewSyntaxEditorInputEventArgs> PreviewSyntaxEditorInput
Event Type
System.EventHandler<PreviewSyntaxEditorInputEventArgs>
|
PreviewSyntaxEditorKeyDown
Occurs before a key down event is processed by the syntax editor, allowing you to intercept and handle keyboard input.
Declaration
public event EventHandler<PreviewSyntaxEditorKeyEventArgs> PreviewSyntaxEditorKeyDown
Event Type
System.EventHandler<PreviewSyntaxEditorKeyEventArgs>
|
PreviewSyntaxEditorKeyUp
Occurs before a key up event is processed by the syntax editor, allowing you to intercept and handle keyboard input.
Declaration
public event EventHandler<PreviewSyntaxEditorKeyEventArgs> PreviewSyntaxEditorKeyUp
Event Type
System.EventHandler<PreviewSyntaxEditorKeyEventArgs>
|
PreviewSyntaxEditorMouseLeftButtonDown
Occurs before a mouse left button down event is processed by the syntax editor, allowing you to intercept and handle mouse input.
Declaration
public event EventHandler<PreviewSyntaxEditorMouseButtonEventArgs> PreviewSyntaxEditorMouseLeftButtonDown
Event Type
System.EventHandler<PreviewSyntaxEditorMouseButtonEventArgs>
|
PreviewSyntaxEditorMouseRightButtonDown
Occurs before a mouse right button down event is processed by the syntax editor, allowing you to intercept and handle context menu actions.
Declaration
public event EventHandler<PreviewSyntaxEditorMouseButtonEventArgs> PreviewSyntaxEditorMouseRightButtonDown
Event Type
System.EventHandler<PreviewSyntaxEditorMouseButtonEventArgs>
|
ScaleFactorChanged
Occurs when the scaling factor of the editor changes, affecting the size of text and UI elements.
Declaration
public event EventHandler ScaleFactorChanged
Event Type
System.EventHandler
|
SelectionChanged
Occurs when the text selection in the editor changes, either by user interaction or programmatically.
Declaration
public event EventHandler SelectionChanged
Event Type
System.EventHandler
|
ViewportChanged
Occurs when the visible area (viewport) of the editor changes, such as during scrolling or resizing.
Declaration
public event EventHandler ViewportChanged
Event Type
System.EventHandler
|