This is a migrated thread and some comments may be shown as answers.

Scroll to bottom when adding content

1 Answer 76 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Hans
Top achievements
Rank 1
Hans asked on 21 Mar 2011, 04:24 PM
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.

1 Answer, 1 is accepted

Sort by
0
Vesko
Telerik team
answered on 24 Mar 2011, 10:02 AM
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
Tags
RichTextBox
Asked by
Hans
Top achievements
Rank 1
Answers by
Vesko
Telerik team
Share this question
or