Back to Devexpress

RichEditControl.DocumentLoaded Event

wpf-devexpress-dot-xpf-dot-richedit-dot-richeditcontrol-7f1c0b20.md

latest3.6 KB
Original Source

RichEditControl.DocumentLoaded Event

Occurs after a document is loaded into the RichEdit control.

Namespace : DevExpress.Xpf.RichEdit

Assembly : DevExpress.Xpf.RichEdit.v25.2.dll

NuGet Package : DevExpress.Wpf.RichEdit

Declaration

csharp
public event EventHandler DocumentLoaded
vb
Public Event DocumentLoaded As EventHandler

Event Data

The DocumentLoaded event's data class is EventArgs.

Remarks

The DocumentLoaded event fires after executing the RichEditControl.LoadDocument or Document.LoadDocument method and after specifying values for the following properties:

The DocumentLoaded fires when the document model is built and the loaded document is valid. Handle the DocumentLayout.DocumentFormatted event to check the loaded document’s layout.

The following code snippet updates fields in the main body of a loaded document:

csharp
richEditControl.LoadDocument("FirstLook.docx");
richEditControl.DocumentLoaded += RichEditControl_DocumentLoaded;

private void RichEditControl1_DocumentLoaded(object sender, EventArgs e)
{
    richEditControl1.BeginInvoke(new Action(() =>
    {
        if (richEditControl1.Document.Fields.Count != 0)
        {
            richEditControl1.Document.Fields.Update();
        }
    }));
}
vb
Private Sub RichEditControl1_DocumentLoaded(ByVal sender As Object, ByVal e As EventArgs)
  richEditControl1.BeginInvoke(New Action(Sub()
    If richEditControl1.Document.Fields.Count <> 0 Then
      richEditControl1.Document.Fields.Update()
    End If
  End Sub))
End Sub

See Also

LoadDocument

CreateNewDocument(Boolean)

RichEditControl.SaveDocument*

RichEditControl.SaveDocument*

RichEditControl Class

RichEditControl Members

DevExpress.Xpf.RichEdit Namespace