How can I make a RichTextBox scroll to the end when I add a new line?

后端 未结 3 1399
半阙折子戏
半阙折子戏 2021-01-07 23:25

I have several read only RichTextBox\'s that are used for logging output. Since they\'re read only they don\'t seem to automatically scroll when the text is updated. I

3条回答
  •  长情又很酷
    2021-01-08 00:11

    I solved this problem using an Interactivity trigger and a very simple action.

    The action looks like this:

    public class ScrollToBottomAction : TriggerAction
    {
        protected override void Invoke(object parameter)
        {
            AssociatedObject.ScrollToEnd();
        }
    }
    

    Then in my XAML I have this:

    
         
                
                    
                
         
    
    

提交回复
热议问题