# Events

This topic covers the specific events exposed by the **RadRichTextEditor** control.

The **RadRichTextEditor** control raises the following specific events:

* **CommandError** - occurs when an error gets thrown while executing a command. The event handler receives two arguments:

  * The sender argument contains the **RadRichTextEditor**. This argument is of type object, but can be cast to the **RadRichTextEditor** type.

  * A **CommandErrorEventArgs** object.

* **CommandExecuted** - occurs after a command gets executed. The event handler receives two arguments:

  * The sender argument contains the **RadRichTextEditor**. This argument is of type object, but can be cast to the **RadRichTextEditor** type.

  * A **CommandExecutedEventArgs** object. This arguments allows you to access the command to be executed and its command parameter.

* **CommandExecuting** - occurs before a command gets executed. The event handler receives two arguments:

  * The sender argument contains the **RadRichTextEditor**. This argument is of type object, but can be cast to the **RadRichTextEditor** type.

  * A **CommandExecutingEventArgs** object. This arguments allows you to access the command to be executed and its command parameter and to cancel the command execution.

* **CurrentEditingStyleChanged** - occurs when the current editing style changes. The event handler receives two arguments:

  * The sender argument contains the **RadRichTextEditor**. This argument is of type object, but can be cast to the **RadRichTextEditor** type.

  * An **EventArgs** object

* **CurrentParagraphStyleChanged** - occurs when the position of the caret goes to another paragraph. The event handler receives two arguments:

  * The sender argument contains the **RadRichTextEditor**. This argument is of type object, but can be cast to the **RadRichTextEditor** type.

  * An **EventArgs** object.

* **CurrentSpanStyleChanged** - occurs when the position of the caret goes to another word. The event handler receives two arguments:

  * The sender argument contains the **RadRichTextEditor**. This argument is of type object, but can be cast to the **RadRichTextEditor** type.

  * An **EventArgs** object.

* **CurrentVisiblePageChanged** - occurs when the current page has changed. The event handler receives two arguments:

  * The sender argument contains the **RadRichTextEditor**. This argument is of type object, but can be cast to the **RadRichTextEditor** type.

  * An **EventArgs** object.

* **DocumentArranged** - occurs when the current document has been arranged. The event handler receives two arguments:

  * The sender argument contains the **RadRichTextEditor**. This argument is of type object, but can be cast to the **RadRichTextEditor** type.

  * An **EventArgs** object.

* **DocumentChanged** - occurs when the current document has been changed. The event handler receives two arguments:

  * The sender argument contains the **RadRichTextEditor**. This argument is of type object, but can be cast to the **RadRichTextEditor** type.

  * An **EventArgs** object.

* **DocumentChanging** - occurs before the current document gets changed. The event handler receives two arguments:

  * The sender argument contains the **RadRichTextEditor**. This argument is of type object, but can be cast to the **RadRichTextEditor** type.

  * An **EventArgs** object.

* **DocumentContentChanged** - occurs when the content of the current document has changed. The event handler receives two arguments:

  * The sender argument contains the **RadRichTextEditor**. This argument is of type object, but can be cast to the **RadRichTextEditor** type.

  * An **EventArgs** object.

* **DocumentLayoutModeChanged** - occurs when the layout mode of the current document has changed. The event handler receives two arguments:

  * The sender argument contains the **RadRichTextEditor**. This argument is of type object, but can be cast to the **RadRichTextEditor** type.

  * An **EventArgs** object.

* **HyperlinkClicked** - occurs when the users clicks on a hyperlink in the current document. The event allows you to either cancel or replace the navigation logic. HyperlinkClicked event can be used as a confirmation from the end-user whether to proceed or not with opening a hyperlink due to security reasons. The event handler receives two arguments:

  * The sender argument contains the **Span** containing the hyperlink's content. This argument is of type object, but can be cast to the **Span** type.

  * A **HyperlinkClickedEventArgs** object. This argument allows you to access the following properties:
    * **Handled**: Get or set a value indicating whether the event is handled.
    * **HyperlinkTarget**: Gets the target hyperlink.
    * **URL**: Gets the URL of the hyperlink.
    * `IsTrustedUrl`: Gets or sets whether navigation is permitted. Set it to `true` only after application-specific validation. Internal bookmark links are trusted by default. Unhandled requests reach `HyperlinkHelper.HyperlinkClicked` after the local event, so set `Handled` to `true` to suppress navigation definitively. See [RichTextEditor hyperlinks](https://www.telerik.com/products/winforms/documentation/controls/richtexteditor/features/hyperlink) and [shared hyperlink validation](https://www.telerik.com/products/winforms/documentation/telerik-presentation-framework/html-like-text-formatting#shared-hyperlink-validation).

* **IsReadOnlyChanged** - occurs when **IsReadOnly** value has changed. The event handler receives two arguments:

  * The sender argument contains the **RadRichTextEditor**. This argument is of type object, but can be cast to the **RadRichTextEditor** type.

  * An **EventArgs** object.

* **ScaleFactorChanged** - occurs when the **ScaleFactor** value has changed. The event handler receives two arguments:

  * The sender argument contains the **RadRichTextEditor**. This argument is of type object, but can be cast to the **RadRichTextEditor** type.

  * An **EventArgs** object.

* **SelectedLayoutBoxChanged** - occurs when the current layout box gets changed. The event handler receives two arguments:

  * The sender argument contains the **RadRichTextEditor**. This argument is of type object, but can be cast to the **RadRichTextEditor** type.

  * A **SelectedLayoutBoxChangedEventArgs** object.

* **BeforeOpenFile** - occurs before a file is opened, before the open file dialog is shown. Subscribe to this event to customize the OpenFileDialog properties (like FileName, Title, Filter, InitialDirectory, etc.) before it is displayed to the user. Allows to be canceled by setting e.Cancel to true.

* **BeforeSaveFile** -  occurs before the file is saved, before the save file dialog is shown. Subscribe to this event to customize the SaveFileDialog properties (like FileName, Title, Filter, InitialDirectory, etc.) before it is displayed to the user. Allows to be canceled by setting e.Cancel to true.

## See Also

* [Getting Started](https://www.telerik.com/products/winforms/documentation/controls/richtexteditor/getting-started/getting-started)
