New to Telerik UI for WinForms? Start a free 30-day trial

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:

C#
public abstract class RichTextBoxCommandBase : ICommand

Inheritance: objectRichTextBoxCommandBase

Derived Classes: AcceptAllRevisionsCommandAcceptRevisionCommandCancelFormatPainterCommandChangeBibliographicStyleCommandChangeColorCommandBaseChangeFontFamilyCommandChangeFontSizeCommandChangeFormatPainterStateCommandChangeIntegratedWatermarkTypeCommandChangeLayoutModeCommandChangeListStyleCommandChangePageMarginsTypeCommandChangePageOrientationCommandChangePaperTypeCommandChangeParagraphFlowDirectionCommandChangeParagraphListLevelCommandChangeSectionColumnsCommandChangeSectionHeaderFooterMarginBaseChangeStyleNameCommandChangeTextAlignmentCommandChangeUnderlineDecorationCommandClearAllFormattingCommandClearFormattingCommandCommentCommandBaseContinueNumberingCommandCopyFormattingCommandDecrementFontSizeCommandDecrementParagraphLeftIndentCommandDeleteCodeBlockCommandDeleteCommandDrawingContextCommandBaseEditFooterCommandEditHeaderCommandExitHeaderFooterEditModeCommandFieldRangeStartBaseCommandBase<T>GoToNextEndnoteCommandGoToNextFootnoteCommandGoToNextRevisionCommandGoToPreviousEndnoteCommandGoToPreviousFootnoteCommandGoToPreviousRevisionCommandImageContextCommandBaseIncrementFontSizeCommandIncrementParagraphLeftIndentCommandInsertBreakCommandInsertColumnBreakCommandInsertDocumentFragmentCommandInsertEndnoteCommandInsertFieldCommandInsertFootnoteCommandInsertLineBreakCommandInsertLineNumberingCommandInsertNonBreakingSpaceCommandInsertPageBreakCommandInsertPictureCommandInsertSectionBreakCommandInsertStructuredDocumentTagCommandInsertTableCommandInsertTextCommandMailMergeDataSourceContextCommandBaseMergeTableCellsCommandMoveCaretCommandMoveSelectionCommandMultipleUndoCommandNewDocumentCommandOpenContextMenuOnNextSpellingErrorCommandOpenDocumentCommandPasteCommandPasteFormattingCommandPrintCommandPrintPreviewCommandRedoCommandRejectAllRevisionsCommandRejectRevisionCommandRemoveWatermarkCommandRestartNumberingCommandSaveCommandSelectAllCommandSelectionEnabledCommandShowAddNewBibliographicReferenceDialogCommandShowChangeEditingPermissionsDialogCommandShowCodeFormattingDialogCommandShowContentControlPropertiesDialogCommandShowDefineNewListStyleDialogCommandShowFindReplaceDialogCommandShowFontPropertiesDialogCommandShowInsertCaptionDialogCommandShowInsertCrossReferenceWindowCommandShowInsertDateTimeDialogCommandShowInsertHyperlinkDialogCommandShowInsertSymbolWindowCommandShowInsertTableDialogCommandShowInsertTableOfContentsDialogCommandShowLineNumberingDialogCommandShowManageBibliographicSourcesDialogCommandShowManageBookmarksDialogCommandShowManageStylesDialogCommandShowNotesDialogCommandShowParagraphPropertiesDialogCommandShowSectionColumnsDialogCommandShowSetNumberingValueDialogCommandShowSpellCheckingDialogCommandShowStyleFormattingPropertiesDialogCommandShowTabStopsPropertiesDialogCommandShowWatermarkSettingsDialogCommandSuppressLineNumberingForCurrentParagraphCommandTabBackwardCommandTabForwardCommandTableContextCommandBaseToggleCommandBaseUndoCommandUpdateAllFieldsCommand...

Implements: ICommand

Constructors

Associates the command with an editor and initializes its availability tracking.

C#
public RichTextBoxCommandBase(RadRichTextBox editor)
Parameters:editorRadRichTextBox

The editor whose state and document are used by this command.

Properties

Gets the associated rich text box.

C#
public RadRichTextBox AssociatedRichTextBox { get; }
Property Value:

The associated rich text box.

Gets a value indicating whether the behavior of the command can be executed in a protected document.

C#
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.

C#
protected virtual bool CanExecuteInReadOnlyMode { get; }
Property Value:

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.

C#
protected virtual bool CanExecuteInReadOnlyRange { get; }

Gets or sets a value indicating whether the command is enabled.

C#
public bool Enabled { get; set; }

Gets whether availability checks apply the stricter permission rules for operations that delete content.

C#
protected virtual bool IsDeletingCommand { get; }

Gets whether the editor caret should receive focus after the command executes.

C#
protected virtual bool ShouldFocusCaretAfterExecute { get; }

Gets the supported CommandTargets for the command.

C#
protected virtual CommandTargets SupportedTargets { get; }

Methods

Determines whether this command can run for the current editor state and command parameter.

C#
public bool CanExecute(object parameter)
Parameters:parameterobject

The command parameter passed to CanExecuteOverride(object).

Returns:

bool

true if the command is available; otherwise, false.

Implements: ICommand.CanExecute(object)

The result accounts for the command's enabled state, editing permissions, read-only state, and supported document target before calling CanExecuteOverride(object).

Performs a check whether the command can be executed specific to the command.

C#
protected virtual bool CanExecuteOverride(object parameter)
Parameters:parameterobject

The command parameter.

Returns:

bool

Executes the command without a command-specific parameter.

C#
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.

C#
public void Execute(object parameter, bool focusCaret)
Parameters:parameterobject

The command-specific parameter.

focusCaretbool

true 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.

C#
public void Execute(object parameter)
Parameters:parameterobject

The command-specific parameter.

Implements: ICommand.Execute(object)

Performs the execute action specific to the command.

C#
protected abstract void ExecuteOverride(object parameter)
Parameters:parameterobject

The command parameter.

Gets the editor's current paragraph style, or a new default paragraph when no editor is associated.

C#
protected Paragraph GetCurrentParagraphStyle()
Returns:

Paragraph

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.

C#
protected Section GetCurrentSectionStyle()
Returns:

Section

The current section or a default section.

Gets the editor's current span style, or a new default span when no editor is associated.

C#
protected Span GetCurrentSpanStyle()
Returns:

Span

The current span style or a default span.

Returns the single selected inline, or the inline at the caret when the selection does not contain one, and selects that inline.

C#
public Inline GetSelectedInlineOrSelectCurrent()
Returns:

Inline

Raises the CanExecuteChanged event.

C#
protected void OnCanExecuteChanged()

Updates derived command state after the active editor or document presentation changes.

C#
protected virtual void UpdateSectionStyle()

Updates derived command state after the current span or paragraph style changes.

C#
protected virtual void UpdateSpanStyle()

Events

Occurs when the command's availability may have changed.

C#
public event EventHandler CanExecuteChanged

Implements: ICommand.CanExecuteChanged