Scrolling RichTextBox to the end does not work when not displayed

I have a WPF RichTextBox in my application which is in a Grid. It is updated every second or second when it displays logs (although sometimes there are no logs for a minute depending on the load).

The grid is not always visible, as it is on its own tab. If the user is on a different tab, the log is not displayed.

My problem is that I want the RichTextBox to scroll to the end every time a new paragraph is added. It seemed simple, because the RichTextBox control has a ScrollToEnd method, so I call this method every time the text is added to the control.

The problem is that this method only works if the control is visible, if the user is on a different tab, the RichTextBox will not scroll to the end, and it looks strange when you click on the tab with the registrar and after a couple of seconds or the longer it scrolls to the bottom, when it should already be down.

Is there a way around this annoying โ€œfeatureโ€ of the control? I would ALWAYS have a RichTextBox at the bottom if the user will not manually control the scroll bar.

Thank!

+4
source share
2 answers

TabControl , " " .

. , .

+3

, ScrollToEnd ? . ?

: TabControl, TabItem IsSelected, ItemContainerStyle. , .


: , .

FlowDocumentScrollViewer. ( RichTextBox, .) , , , , - , .

:

  • , , .
  • , .
  • , , , .

, , , .

+1

All Articles