开发者

Verticall scroll richtextbox on the bottom [WPF]

I have a richtextbox and when is full I want automatically scroll to the bottom, It is possibl开发者_C百科e? Do this with xaml?


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


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


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

void Output_TextChanged(object sender, TextChangedEventArgs e)
{
    Output.ScrollToEnd();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜