# Active Document Editor

RadRichTextBox displays the different parts of its content using few different document editors. A document editor is a control that implements the [IDocumentEditor](https://docs.telerik.com/devtools/wpf/api/telerik.windows.documents.model.idocumenteditor) interface. For example the RadRichTextBox control.

* [Document Editor Types](https://www.telerik.com/products/wpf/documentation/controls/radrichtextbox/getting-started/getting-started-active-document-editor#document-editor-types)
* [Using the Active Document Editor](https://www.telerik.com/products/wpf/documentation/controls/radrichtextbox/getting-started/getting-started-active-document-editor#using-the-active-document-editor)

## Document Editor Types

There are few types of document editors.

* **MainDocument**: This is the RadRichtTextBox control that displays the main document.

* **Header**: This is the document editor that displays a header in the document. When you start editing a header, this type of document editor is activated. Read more about headers and footers in [Headers and Footers help article](https://www.telerik.com/products/wpf/documentation/controls/radrichtextbox/features/headers-and-footers)

* **Footer**: This is the document editor that displays a footer in the document. When you start editing a footer, this type of document editor is activated.

* **Note**: This is the document editor that displays notes in the document. When you start editing a note, this type of document editor is activated. Read more about notes in the [Footnotes and Endnotes](https://www.telerik.com/products/wpf/documentation/controls/radrichtextbox/features/references/footnotes-endnotes) help article.

* **Comment**: This is the document editor that displays a comment in the document. When you start editing a comment, this type of document editor is activated. Read more about comments in the [Comments](https://www.telerik.com/products/wpf/documentation/controls/radrichtextbox/features/comments) help article.

## Using the Active Document Editor

You can get the active editor via the **ActiveDocumentEditor** property of RadRichTextBox.

**Example 1: Getting the active document editor**

```C#
IDocumentEditor activeEditor = radRichTextBox.ActiveDocumentEditor;
```

You can see when the active editor is changed using the **ActiveDocumentEditorChanged** event. The event arguments contain the editor's type which you can get via the args' **DocumentEditorType** property. This event is useful when you need to modify the active document editor or subscribe for its events.

**Example 2: Using the ActiveDocumentEditorChanged event**

```C#
private void Rtb_ActiveDocumentEditorChanged(object sender, Telerik.Windows.Documents.UI.ActiveDocumentEditorChangedEventArgs e)
{
    var richTextBox = (RadRichTextBox)sender;
    if (e.DocumentEditorType == Telerik.Windows.Documents.UI.DocumentEditorType.Header)
    {
        RadRichTextBox activeEditor = (RadRichTextBox)richTextBox.ActiveDocumentEditor;
        activeEditor.CommandExecuting += ActiveEditor_CommandExecuting;
    }
}

private void ActiveEditor_CommandExecuting(object sender, Telerik.Windows.Documents.RichTextBoxCommands.CommandExecutingEventArgs e)
{
}
```

## Telerik UI for WPF Learning Resources

* [Telerik UI for WPF RichTextBox Component](https://www.telerik.com/products/wpf/richtextbox.aspx)
* [Getting Started with Telerik UI for WPF Components](https://www.telerik.com/products/wpf/documentation/getting-started/first-steps-nuget)
* [Telerik UI for WPF Installation](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/installation-guide)
* [Telerik UI for WPF and WinForms Integration](https://www.telerik.com/products/wpf/documentation/common-information/winforms-integration/overview)
* [Telerik UI for WPF Visual Studio Templates](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/visual-studio-templates)
* [Setting a Theme with Telerik UI for WPF](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-setting-a-theme-overview)
* [Telerik UI for WPF Virtual Classroom (Training Courses for Registered Users)](https://learn.telerik.com/learn/course/external/view/elearning/16/telerik-ui-for-wpf)
* [Telerik UI for WPF License Agreement](https://www.telerik.com/purchase/license-agreement/wpf-dlw-s)

## See Also

* [Getting Started](https://www.telerik.com/products/wpf/documentation/controls/radrichtextbox/getting-started/getting-started)
* [RadDocument](https://www.telerik.com/products/wpf/documentation/controls/radrichtextbox/document-elements/features-raddocument)
* [Developer Focused Examples](https://www.telerik.com/products/wpf/documentation/controls/radrichtextbox/sdk-examples)
