Verticall scroll richtextbox on the bottom [WPF]

2019-07-17 05:33发布

I have a richtextbox and when is full I want automatically scroll to the bottom, It is possible? Do this with xaml?

3条回答
SAY GOODBYE
2楼-- · 2019-07-17 06:03

RichTextBox has a ScrollToEnd method that could be called in the Codebehind. I don't know a way to do this in XAML only.

查看更多
放荡不羁爱自由
3楼-- · 2019-07-17 06:05

By using ScrollViewer.ScrollChanged routed event, and writing some code (for example, richTextBox1.ScrollToEnd()), you may be able to do what you want.

查看更多
爷的心禁止访问
4楼-- · 2019-07-17 06:16

Assuming your RichTextBox is named Output, attach this method to its TextChanged event:

void Output_TextChanged(object sender, TextChangedEventArgs e)
{
    Output.ScrollToEnd();
}
查看更多
登录 后发表回答