Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
Scrolling within a XamRichTextEditor
posted

Dear support,

I have a very simple question I am struggeling with:

How can I scroll to the current caret location or any selection within a XamRichTextEditor?

I highly appreciate any quick help!

Thank you in advance,

Marc

Parents
  • 34810
    Offline posted

    Hello Marc,

    In order to set the scroll position of the XamRichTextEditor, you can set the XamRichTextEditor.ActiveDocumentView.VerticalViewOffset property.

    If you are looking to set this to a particular selection, you can get the selection’s offset by using the various properties on the Selection element returned by the XamRichTextEditor.Selection property. For example, you can use the DocumentSpan.Offset or use the Cells or Paragraphs collection to get the offset as well.

    It is worth noting that you can also move to the very start or very end of the document by using the RichTextEditorCommand class as well. This can be done with the following code, where “rte1” is the XamRichTextEditor:

    RichTextEditorCommand cmd = new RichTextEditorCommand(Infragistics.Controls.Editors.RichTextEditorCommandType.MoveToEndOfDocument);
    cmd.Execute(rte1);

    I hope this helps. Please let me know if you have any other questions or concerns on this matter.

Reply Children