RadSyntaxEditor
Class RadSyntaxEditor. Implements the ITextDocumentEditor
Definition
Namespace:Telerik.Windows.Controls
Assembly:Telerik.Windows.Controls.SyntaxEditor.dll
Syntax:
[TelerikToolboxCategory("Input")]
public class RadSyntaxEditor : Control, ITextDocumentEditor, IDisposable
Inheritance: objectRadSyntaxEditor
Implements:
Constructors
Initializes a new instance of the RadSyntaxEditor class.
public RadSyntaxEditor()
Fields
AcceptsReturnProperty
DependencyProperty
Registers the AcceptsReturn property.
public static readonly DependencyProperty AcceptsReturnProperty
AllowScalingProperty
DependencyProperty
Registers the AllowScaling dependency property.
public static readonly DependencyProperty AllowScalingProperty
AutoScrollToCaretOnTextChangeProperty
DependencyProperty
Registers the AutoScrollToCaretOnTextChange dependency property.
public static readonly DependencyProperty AutoScrollToCaretOnTextChangeProperty
CaretBrushProperty
DependencyProperty
Registers the CaretBrush dependency property.
public static readonly DependencyProperty CaretBrushProperty
EditorFontFamilyProperty
DependencyProperty
Registers the EditorFontFamily dependency property.
public static readonly DependencyProperty EditorFontFamilyProperty
EditorFontSizeProperty
DependencyProperty
Registers the EditorFontSize dependency property.
public static readonly DependencyProperty EditorFontSizeProperty
HorizontalScrollBarVisibilityProperty
DependencyProperty
Registers the HorizontalScrollBarVisibility dependency property.
public static readonly DependencyProperty HorizontalScrollBarVisibilityProperty
IndentProviderProperty
DependencyProperty
Registers the IndentProvider property.
public static readonly DependencyProperty IndentProviderProperty
InsertModeProperty
DependencyProperty
Registers the InsertMode property.
public static readonly DependencyProperty InsertModeProperty
IsCaretVisibleProperty
DependencyProperty
Registers the IsCaretVisible dependency property.
public static readonly DependencyProperty IsCaretVisibleProperty
IsReadOnlyProperty
DependencyProperty
Registers the IsReadOnly property.
public static readonly DependencyProperty IsReadOnlyProperty
IsSelectionEnabledProperty
DependencyProperty
Registers the IsSelectionEnabled dependency property.
public static readonly DependencyProperty IsSelectionEnabledProperty
IsWordWrapEnabledProperty
DependencyProperty
Registers the IsWordWrapEnabled dependency property.
public static readonly DependencyProperty IsWordWrapEnabledProperty
PaletteProperty
DependencyProperty
Registers the Palette dependency property.
public static readonly DependencyProperty PaletteProperty
ScaleFactorProperty
DependencyProperty
Registers the ScaleFactor dependency property.
public static readonly DependencyProperty ScaleFactorProperty
SearchPanelWidthProperty
DependencyProperty
Registers the SearchPanelWidth dependency property.
public static readonly DependencyProperty SearchPanelWidthProperty
SelectionFillProperty
DependencyProperty
Registers the SelectionFill dependency property.
public static readonly DependencyProperty SelectionFillProperty
SelectionStrokeProperty
DependencyProperty
Registers the SelectionStroke dependency property.
public static readonly DependencyProperty SelectionStrokeProperty
ShouldTaggersProcessEntireLinesProperty
DependencyProperty
Registers the ShouldTaggersProcessEntireLines dependency property.
public static readonly DependencyProperty ShouldTaggersProcessEntireLinesProperty
VerticalScrollBarVisibilityProperty
DependencyProperty
Registers the VerticalScrollBarVisibility dependency property.
public static readonly DependencyProperty VerticalScrollBarVisibilityProperty
Properties
Gets or sets a value indicating whether [accepts return].
public bool AcceptsReturn { get; set; }
true if [accepts return]; otherwise, false.
Gets or sets a value indicating whether [allow scaling].
public bool AllowScaling { get; set; }
true if [allow scaling]; otherwise, false.
Gets or sets a value indicating whether the document is automatically scrolled to the CaretPosition when the text inside the document is changed.
public bool AutoScrollToCaretOnTextChange { get; set; }
CaretBrush
Brush
Gets or sets the brush of the active caret in the editor.
public Brush CaretBrush { get; set; }
Gets or sets the caret display mode.
public CaretDisplayMode CaretDisplayMode { get; set; }
The caret display mode.
Gets the caret position.
public CaretPosition CaretPosition { get; }
The caret position.
Gets the commands.
public SyntaxEditorCommands Commands { get; }
The commands.
Gets or sets the current insert mode.
public string CurrentInsertMode { get; set; }
The current insert mode.
Gets or sets the text document.
public TextDocument Document { get; set; }
The document.
Implements:
EditorFontFamily
FontFamily
Gets or sets a value indicating the font family of the text editor.
public FontFamily EditorFontFamily { get; set; }
Gets or sets a value indicating the font size of the text editor.
public double EditorFontSize { get; set; }
Gets the editor presenter.
public SyntaxEditorPresenter EditorPresenter { get; }
The editor presenter.
Gets the folding manager.
public FoldingManager FoldingManager { get; }
The folding manager.
HorizontalScrollBar
ScrollBar
Gets the horizontal scroll bar.
public ScrollBar HorizontalScrollBar { get; }
The horizontal scroll bar.
HorizontalScrollBarVisibility
ScrollBarVisibility
Gets or sets the horizontal scroll bar visibility.
public ScrollBarVisibility HorizontalScrollBarVisibility { get; set; }
The horizontal scroll bar visibility.
Gets or sets the indent provider.
public ISmartIndentProvider IndentProvider { get; set; }
The indent provider.
Gets the intelli prompts.
public SyntaxEditorIntelliPrompts IntelliPrompts { get; }
The intelli prompts.
Gets or sets a value indicating whether this instance is caret visible.
public bool IsCaretVisible { get; set; }
true if this instance is caret visible; otherwise, false.
Gets a value indicating whether this instance is in undo group.
public bool IsInUndoGroup { get; }
true if this instance is in undo group; otherwise, false.
Gets or sets a value indicating whether this instance is overwrite mode enabled.
public bool IsOverwriteModeEnabled { get; set; }
true if this instance is overwrite mode enabled; otherwise, false.
Gets or sets a value indicating whether this instance is read only.
public bool IsReadOnly { get; set; }
true if this instance is read only; otherwise, false.
Gets or sets a value indicating whether this instance is selection enabled.
public bool IsSelectionEnabled { get; set; }
true if this instance is selection enabled; otherwise, false.
Gets or sets a value indicating whether the word wrapping mode is enabled.
public bool IsWordWrapEnabled { get; set; }
Gets the key bindings.
public KeyBindingUtilities KeyBindings { get; }
The key bindings.
Gets the margins.
public SyntaxEditorMargins Margins { get; }
The margins.
Gets or sets the palette of syntax elements' colors used for this RadSyntaxEditor instance.
public SyntaxEditorPalette Palette { get; set; }
Gets the properties.
public SyntaxEditorProperties Properties { get; }
The properties.
Gets or sets the scale factor.
public double ScaleFactor { get; set; }
The scale factor.
Gets or sets a value indicating the width of the search panel.
public double SearchPanelWidth { get; set; }
Gets the selection.
public Selection Selection { get; }
The selection.
SelectionFill
Brush
Gets or sets the selection fill.
public Brush SelectionFill { get; set; }
The selection fill.
SelectionStroke
Brush
Gets or sets the selection stroke.
public Brush SelectionStroke { get; set; }
The selection stroke.
Gets or sets whether taggers are given the entire lines of text (true) or only the currently visible in the viewport part of the text (false) for processing. Default value is false.
public bool ShouldTaggersProcessEntireLines { get; set; }
Gets the taggers registry.
public TaggersRegistry TaggersRegistry { get; }
The taggers registry.
Gets the text format definitions.
public TextFormatDefinitionStack TextFormatDefinitions { get; }
The text format definitions.
Gets or sets a value indicating the touch drag area around a touch selection marker.
public double TouchMarkerDragDistance { get; set; }
Gets or sets the UI layers builder.
public UILayersBuilder UILayersBuilder { get; set; }
The UI layers builder.
Gets or sets a value indicating whether [use monospaced font optimization].
public bool UseMonospacedFontOptimization { get; set; }
true if [use monospaced font optimization]; otherwise, false.
Gets or sets a value indicating whether [use shift key in selection].
public bool UseShiftKeyInSelection { get; set; }
true if [use shift key in selection]; otherwise, false.
VerticalScrollBar
ScrollBar
Gets the vertical scroll bar.
public ScrollBar VerticalScrollBar { get; }
The vertical scroll bar.
VerticalScrollBarVisibility
ScrollBarVisibility
Gets or sets the vertical scroll bar visibility.
public ScrollBarVisibility VerticalScrollBarVisibility { get; set; }
The vertical scroll bar visibility.
Viewport
Rect
Gets the viewport.
public Rect Viewport { get; }
The viewport.
Methods
Backspaces this instance.
public void Backspace()
Begins the undo group.
public void BeginUndoGroup()
Cancels the undo group.
public void CancelUndoGroup()
Closes the find dialog.
public void CloseFindDialog()
Completes the code.
public void CompleteCode()
Copies this instance.
public void Copy()
Creates the state of the code editor history.
public SyntaxEditorHistoryState CreateSyntaxEditorHistoryState()
SyntaxEditorHistoryState.
Cuts this instance.
public void Cut()
Decreases the line indent.
public void DecreaseLineIndent()
Deletes this instance.
public void Delete()
Deletes the full line.
public void DeleteFullLine()
Deletes the word to left.
public void DeleteWordToLeft()
Deletes the word to right.
public void DeleteWordToRight()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Implements:
Releases unmanaged and - optionally - managed resources.
protected virtual void Dispose(bool disposing)
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Ends the undo group.
public void EndUndoGroup()
Finds the specified search text.
public Span? Find(string searchText, int startIndex, bool matchCase, bool useRegularExpression, bool matchWord)
The search text or regex pattern.
startIndexintThe start index to search in the document.
matchCaseboolIndicates whether the search is case-sensitive.
useRegularExpressionboolIf set to true indicates that the search text will be used as regular expression search pattern.
If set to true, indicates that the search finds whole words only.
Span?
Nullable Span which, when not null, indicates the found text.
Finds the specified search text.
public Span? Find(string searchText, int startIndex, bool matchCase, bool useRegularExpression)
The search text or regex pattern.
startIndexintThe start index to search in the document.
matchCaseboolIndicates whether the search is case-sensitive.
useRegularExpressionboolIf set to true indicates that the search text will be used as regular expression search pattern.
Span?
Nullable Span which, when not null, indicates the found text.
Finds the specified search text.
public Span? Find(string searchText, int startIndex, bool useRegularExpression)
The search text or regex pattern.
startIndexintThe start index to search in the document.
useRegularExpressionboolIf set to true indicates that the search text will be used as regular expression search pattern.
Span?
Nullable Span which, when not null, indicates the found text.
Finds all spans with the given searchText or regex pattern.
public IEnumerable<Span> FindAll(string searchText, bool matchCase, bool useRegularExpression, bool matchWord)
The search text or regex pattern.
matchCaseboolIndicates whether the search is case-sensitive.
useRegularExpressionboolIf set to true indicates that the search text will be used as regular expression search pattern.
If set to true, indicates that the search finds whole words only.
List of all matched spans.
Finds all spans with the given searchText or regex pattern.
public IEnumerable<Span> FindAll(string searchText, bool matchCase, bool useRegularExpression)
The search text or regex pattern.
matchCaseboolIndicates whether the search is case-sensitive.
useRegularExpressionboolIf set to true indicates that the search text will be used as regular expression search pattern.
List of all matched spans.
Finds all spans with the given searchText or regex pattern.
Finds all spans with the given searchText.
public IEnumerable<Span> FindAll(string searchText)
The search text.
Returns:List of all matched spans.
Finds the specified search text before the current index.
public Span? FindPrevious(string searchText, int startIndex, bool matchCase, bool useRegularExpression, bool matchWord)
The search text or regex pattern.
startIndexintThe start index to search in the document.
matchCaseboolIndicates whether the search is case-sensitive.
useRegularExpressionboolIf set to true indicates that the search text will be used as regular expression search pattern.
If set to true, indicates that the search finds whole words only.
Span?
Nullable Span which, when not null, indicates the found text.
Finds the specified search text before the current index.
public Span? FindPrevious(string searchText, int startIndex, bool matchCase)
The search text or regex pattern.
startIndexintThe start index to search in the document.
matchCaseboolIndicates whether the search is case-sensitive.
Returns:Span?
Nullable Span which, when not null, indicates the found text.
Gets the point from position.
public Point GetPointFromPosition(CaretPosition position)
The position.
Returns:Point
Point.
Gets the position from point.
public CaretPosition GetPositionFromPoint(Point point)
The point.
Returns:CaretPosition.
Tries to highlight all span matches via all registered TextSearchHighlightTaggers.
Increases the line indent.
public void IncreaseLineIndent()
Indents this instance.
public void Indent()
Called when touch manager methods are being initialized for the SyntaxEditorPresenter.
protected virtual void InitializeTouch(SyntaxEditorPresenter presenter)
Inserts the specified text.
Inserts the new line.
public void InsertNewLine()
Inserts the tab.
public void InsertTab()
Invalidates the editor layout.
public void InvalidateEditorLayout()
Invalidates the editor layout.
Called when control is measured.
protected override Size MeasureOverride(Size constraint)
Size
Moves the current line to bottom.
public void MoveCurrentLineToBottom()
Moves the current line to top.
public void MoveCurrentLineToTop()
Navigates to the next matched text in the editor.
Navigates to the next matched text in the editor.
When overridden in a derived class, is invoked whenever application code or internal processes call .
public override void OnApplyTemplate()
Handles the event.
protected virtual void OnCommandError(CommandErrorEventArgs args)
The CommandErrorEventArgs instance containing the event data.
Handles the event.
protected virtual void OnCommandExecuted(CommandExecutedEventArgs e)
The CommandExecutedEventArgs instance containing the event data.
Handles the event.
protected virtual void OnCommandExecuting(CommandExecutingEventArgs args)
The CommandExecutingEventArgs instance containing the event data.
OnCreateAutomationPeer()
AutomationPeer
Returns class-specific AutomationPeer implementations for the Windows Presentation Foundation (WPF) infrastructure.
protected override AutomationPeer OnCreateAutomationPeer()
AutomationPeer
The type-specific AutomationPeer implementation.
Called when [document changed].
protected virtual void OnDocumentChanged()
Called when [document changing].
protected virtual void OnDocumentChanging()
Handles the event.
protected virtual void OnDocumentContentChanged(TextContentChangedEventArgs args)
The TextContentChangedEventArgs instance containing the event data.
Handles the event.
protected virtual void OnDocumentContentChanging(TextContentChangingEventArgs args)
The TextContentChangingEventArgs instance containing the event data.
Invoked whenever an unhandled event reaches this element in its route.
protected override void OnGotFocus(RoutedEventArgs e)
The RoutedEventArgs that contains the event data.
Raises the event. This method is invoked whenever is set to true internally.
protected override void OnInitialized(EventArgs e)
The RoutedEventArgs that contains the event data.
Called when [layout properties changed].
protected virtual void OnLayoutPropertiesChanged()
Handles the event.
protected virtual void OnPreviewSyntaxEditorInput(PreviewSyntaxEditorInputEventArgs args)
The PreviewSyntaxEditorInputEventArgs instance containing the event data.
Handles the event.
protected virtual void OnPreviewSyntaxEditorKeyDown(PreviewSyntaxEditorKeyEventArgs args)
The PreviewSyntaxEditorKeyEventArgs instance containing the event data.
Handles the event.
protected virtual void OnPreviewSyntaxEditorKeyUp(PreviewSyntaxEditorKeyEventArgs args)
The PreviewSyntaxEditorKeyEventArgs instance containing the event data.
Handles the event.
protected virtual void OnPreviewSyntaxEditorMouseLeftButtonDown(PreviewSyntaxEditorMouseButtonEventArgs args)
The PreviewSyntaxEditorMouseButtonEventArgs instance containing the event data.
Handles the event.
protected virtual void OnPreviewSyntaxEditorMouseRightButtonDown(PreviewSyntaxEditorMouseButtonEventArgs args)
The PreviewSyntaxEditorMouseButtonEventArgs instance containing the event data.
Occurs when property changes.
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
Called when [scale factor changed].
protected virtual void OnScaleFactorChanged()
Called when search panel is closed.
protected virtual void OnSearchPanelClosed()
Called when search panel is opened.
protected virtual void OnSearchPanelOpened()
Called when the selection changes.
protected virtual void OnSelectionChanged()
Handles the event.
protected virtual void OnTextSearched(TextSearchedEventArgs args)
The TextSearchedEventArgs instance containing the event data.
Called when [viewport changed].
protected virtual void OnViewportChanged()
Opens the find dialog with the specified searchText in the search textbox.
Pages down.
public void PageDown()
Pages up.
public void PageUp()
Pastes this instance.
public void Paste()
Replaces all matches.
public int ReplaceAllMatches(string searchText, string replaceText, bool matchCase, bool useRegularExpression, bool matchWord)
The search text.
replaceTextstringThe replace text.
matchCaseboolThe match case.
useRegularExpressionboolThe use regular expression.
matchWordboolThe match word.
Returns:System.Int32.
Replaces all matches.
Replaces the next match.
public bool ReplaceNextMatch(string searchText, int startIndex, string replaceText, bool matchCase, bool useRegularExpression)
The search text.
startIndexintThe start index.
replaceTextstringThe replace text.
matchCaseboolThe match case.
useRegularExpressionboolThe use regular expression.
Returns:System.Boolean.
Restores the state of the code editor history.
public void RestoreSyntaxEditorHistoryState(SyntaxEditorHistoryState historyState)
State of the history.
Selects all.
public void SelectAll()
Toggles the insert mode.
public void ToggleInsertMode()
Unindents this instance.
public void Unindent()
Updates the selection.
public void UpdateSelection()
Zooms in.
public void ZoomIn(double zoomFactor = 1.1)
The zoom increase factor. Should be a number greater than 1. Default value is 1.1.
Zooms out.
public void ZoomOut(double zoomFactor = 0.91)
The zoom decrease factor. Should be a number less than 1. Default value is 0.91.
Zooms to particular zoom level.
public void ZoomTo(double zoomLevel)
The zoom level.
Exceptions:ZoomLevel must be non negative.
Events
Occurs when command error is produced.
public event EventHandler<CommandErrorEventArgs> CommandError
Occurs when command is executed.
public event EventHandler<CommandExecutedEventArgs> CommandExecuted
Occurs when command is executing.
public event EventHandler<CommandExecutingEventArgs> CommandExecuting
Occurs when document has been changed.
public event EventHandler DocumentChanged
Implements:
Occurs when document is being changed.
public event EventHandler DocumentChanging
Implements:
DocumentContentChanged event.
public event EventHandler<TextContentChangedEventArgs> DocumentContentChanged
Implements:
DocumentContentChanging event.
public event EventHandler<TextContentChangingEventArgs> DocumentContentChanging
Occurs when the readonly state has changed.
public event EventHandler IsReadOnlyChanged
Occurs when layout properties are changed.
public event EventHandler LayoutPropertiesChanged
Occurs when text input in the syntax editor is starting.
public event EventHandler<PreviewSyntaxEditorInputEventArgs> PreviewSyntaxEditorInput
Occurs when key down is pressed.
public event EventHandler<PreviewSyntaxEditorKeyEventArgs> PreviewSyntaxEditorKeyDown
Occurs when a key is released.
public event EventHandler<PreviewSyntaxEditorKeyEventArgs> PreviewSyntaxEditorKeyUp
Occurs when mouse left button down is pressed.
public event EventHandler<PreviewSyntaxEditorMouseButtonEventArgs> PreviewSyntaxEditorMouseLeftButtonDown
Occurs when mouse right button down is pressed.
public event EventHandler<PreviewSyntaxEditorMouseButtonEventArgs> PreviewSyntaxEditorMouseRightButtonDown
Occurs when scale factor changes.
public event EventHandler ScaleFactorChanged
Occurs when the search panel is closed.
public event EventHandler SearchPanelClosed
Occurs when the search panel is opened.
public event EventHandler SearchPanelOpened
Occurs when the selection of the control changes.
public event EventHandler SelectionChanged
Occurs when a text is searched in the control.
public event EventHandler<TextSearchedEventArgs> TextSearched
Occurs when the viewport changes.
public event EventHandler ViewportChanged