How to scroll up to the next new line automatically

5 posts, 0 answers
  1. DQ
    DQ avatar
    11 posts
    Member since:
    Jul 2012

    Posted 19 Jul 2012 Link to this post

    Hi All,

    I am using the RadRichTextBox.  The problem is that when users press enter at the last line at the bottom of the panel during editing, the next new line does not scroll up automatically.  He/she must - painfully - use the scroll bar to make the text line scroll up, and then editing. 

    How do I make the next newly line scroll up automatically?

    Thanks.
  2. Lancelot
    Lancelot avatar
    251 posts
    Member since:
    Jul 2012

    Posted 20 Jul 2012 Link to this post

    Hi DQ,

    You can programmatically chose where the caret is and where the document is. This link will show you how to position the control in the way you want it to.

    Also, while you're in the documentation, notice the expanded RichTextBox tree in the left pane. You'll find that will come in handy for any future issues you may have or as a resource for example code and guidance.

    Good Luck,
    Lancelot
  3. DevCraft banner
  4. Martin Ivanov
    Admin
    Martin Ivanov avatar
    104 posts

    Posted 24 Jul 2012 Link to this post

    Hi DQ,

    What we could add to Lancelot's reply is that we have not been able to reproduce the problem you have described. You can indeed use the methods of the editor to adjust the caret position and the viewport should follow the caret. In addition, you can use the method of the editor ScrolltToVerticalOffset, but this is normally not needed.

    Can you please be more descriptive about your issue:
    • can you reproduce the same behavior in the online demo?
    • in what container have you placed the RadRichTextBox?
    • send us code reproducing the problem.

    All the best,
    Martin
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. DQ
    DQ avatar
    11 posts
    Member since:
    Jul 2012

    Posted 25 Jul 2012 Link to this post

    Hi Martin,

    No, I can't make it happen on the online demo,  but I can make it happen on my machine here.  If I don't specify the width and the height of the parent object (which is another user defined control ), the RadRichTextBox seems to lost track of the panel coordination and dice things happen.

    Anyway, I specified the width and the height (statically in the xaml), and it works the way I want now.

    Thanks.
  6. Martin Ivanov
    Admin
    Martin Ivanov avatar
    104 posts

    Posted 26 Jul 2012 Link to this post

    Hi DQ,

    We are glad that you found a solution to the problem. If the containing control has infinite height or width, RadRichTextBox will not work properly. For example nesting the control in scroll viewer produces such issues.

    Don't hesitate to contact us if you have other questions.

    Kind regards,
    Martin
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
DevCraft banner