Provides editor association, availability checks, and execution events for rich-text-box commands.
Definition
Namespace:Telerik.WinForms.Documents.RichTextBoxCommands
Assembly:Telerik.WinControls.RichTextEditor.dll
Syntax:
public abstract class RichTextBoxCommandBase : ICommand
Inheritance: objectRichTextBoxCommandBase
Derived Classes:
Implements:
Constructors
Associates the command with an editor and initializes its availability tracking.
public RichTextBoxCommandBase(RadRichTextBox editor)
The editor whose state and document are used by this command.
Properties
Gets the associated rich text box.
public RadRichTextBox AssociatedRichTextBox { get; }
The associated rich text box.
Gets a value indicating whether the behavior of the command can be executed in a protected document.
protected virtual CanExecuteBehaviorInProtectedDocument CanExecuteBehaviorInProtectedDocument { get; }
Gets a value indicating whether this command can be executed when RadRichTextBox is read-only. The default implementation returns false.
protected virtual bool CanExecuteInReadOnlyMode { get; }
true if this command preserves document's content; otherwise, false.
Gets a value indicating whether this command can be executed when editing context is read-only. The default implementation returns false.
protected virtual bool CanExecuteInReadOnlyRange { get; }
Gets or sets a value indicating whether the command is enabled.
public bool Enabled { get; set; }
Gets whether availability checks apply the stricter permission rules for operations that delete content.
protected virtual bool IsDeletingCommand { get; }
Gets whether the editor caret should receive focus after the command executes.
protected virtual bool ShouldFocusCaretAfterExecute { get; }
Gets the supported CommandTargets for the command.
protected virtual CommandTargets SupportedTargets { get; }
Methods
Determines whether this command can run for the current editor state and command parameter.
public bool CanExecute(object parameter)
The command parameter passed to CanExecuteOverride(object).
Returns:Implements:
The result accounts for the command's enabled state, editing permissions, read-only state, and supported document target before calling CanExecuteOverride(object).
Executes the command without a command-specific parameter.
public void Execute()
Raises the editor's command-executing event, invokes the command, optionally focuses the active editor, and then raises the command-executed event.
public void Execute(object parameter, bool focusCaret)
The command-specific parameter.
focusCaretbooltrue to focus the active editor after execution.
Execution stops when the command-executing event is canceled. Exceptions are reported through the editor's command-error event.
Executes the command with the specified parameter and uses ShouldFocusCaretAfterExecute to determine whether to focus the editor afterward.
public void Execute(object parameter)
The command-specific parameter.
Implements:
Performs the execute action specific to the command.
protected abstract void ExecuteOverride(object parameter)
The command parameter.
Gets the editor's current paragraph style, or a new default paragraph when no editor is associated.
protected Paragraph GetCurrentParagraphStyle()
The current paragraph style or a default paragraph.
Gets the editor's current section, or a new default section when no editor or current section is available.
protected Section GetCurrentSectionStyle()
The current section or a default section.
Gets the editor's current span style, or a new default span when no editor is associated.
Returns the single selected inline, or the inline at the caret when the selection does not contain one, and selects that inline.
Raises the CanExecuteChanged event.
protected void OnCanExecuteChanged()
Updates derived command state after the active editor or document presentation changes.
protected virtual void UpdateSectionStyle()
Updates derived command state after the current span or paragraph style changes.
protected virtual void UpdateSpanStyle()
Events
Occurs when the command's availability may have changed.
public event EventHandler CanExecuteChanged
Implements: