How to automatically scroll ScrollViewer - only if the user did not change scroll position
Posted
by Elad
on Stack Overflow
See other posts from Stack Overflow
or by Elad
Published on 2010-06-06T15:48:12Z
Indexed on
2010/06/06
15:52 UTC
Read the original article
Hit count: 706
I would like to create the following behaviour in a ScrollViewer that wraps ContentControl:
When the ContentControl height grows , the ScrollViewer should automatically scroll to the end. This is easy to achive by using ScrollViewer.ScrollToEnd().
However, if the user uses the scroll bar, the automatic scrolling shouldn't happen anymore. This is similar to what happens in VS output window for example.
The problem is to know when a scrolling has happened because of user scrolling and when it happened because the content size changed. I tried to play with the ScrollChangedEventArgsof ScrollChangedEvent, but couldn't get it to work.
Ideally, I do not want to handle all possible Mouse and keyboard events.
© Stack Overflow or respective owner