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

RichTextBox MVVM scroll to end

1 Answer 630 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 11 Oct 2011, 03:13 AM
Hi -

I am currently using a trial of the Telerik WPF products and so far I am impressed.

I'm using a RichTextBox and I am data binding it into my ViewModel using the subclass I found on your forums which uses the HtmlFormatProvider and a RichText dependency property. This particular text box has text added to it regularly. I would like to keep the scroll bar scrolled to the bottom so you can always see the last line of text added to the text box and I'd like to do it with data binding if possible so that I don't break my MVVM. What would be the best approach?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Boby
Telerik team
answered on 14 Oct 2011, 08:48 AM
Hello Eric,
You can use ScrollToVerticalOffset method to scroll to the bottom (for example, when RichText property changes its value):
this.radRichTextBox.ScrollToVerticalOffset(double.MaxValue);
You can use attached behaviors (from the Expression Blend SDK) if you want to avoid using code-behind in this case.

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

All the best,
Boby
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
RichTextBox
Asked by
Eric
Top achievements
Rank 1
Answers by
Boby
Telerik team
Share this question
or