New to Telerik UI for WPF? Download free 30-day trial

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 interface. For example the RadRichTextBox control.

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

  • 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 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 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

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

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

See Also

In this article