Scroll to bottom when adding content

2 posts, 0 answers
  1. Hans
    Hans avatar
    28 posts
    Member since:
    Mar 2011

    Posted 21 Mar 2011 Link to this post

    I want the richTextBox to scroll to the bottom when adding new content.
    How can I do this?

    I tried:
    ChatBox.VerticalScrollBar.Value = ChatBox.VerticalScrollBar.Maximum;

    This just sets the scrollbar to the bottom but the textbox isn't affected by it.
  2. Vesko
    Admin
    Vesko avatar
    45 posts

    Posted 24 Mar 2011 Link to this post

    Hi Hans,

    Thanks for your question!
    You can programmatically move the caret to the last position in document. Thus the viewport will be moved too and you will get the desired effect.
    Use the following code:

    ChatBox.Document.CaretPosition.MoveToLastPositionInDocument();

    We have plans for adding an API for programmatically scrolling the view port of RadRichTextBox but I cannot state whether it will be available sooner than our next official release.

    Please do not hesitate to contact us if you need any further assistance.

    All the best,
    Vesko
    the Telerik team
Back to Top