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;
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)
{
}