views:

108

answers:

1

I have a View and a ViewModel in Silverlight 3.0.

The view contains a standard ScrollViewer, which contains dynamic content.

Depending on the content within the ScrollViewer, the user could have scrolled half way down the content, and then performed an action that causes the ScrollViewer to load new content, but the ScrollViewer does not automatically scroll to the top.

I want to be able to bind to the VerticalOffset property, but it is read-only. Any ideas on attachable behavior? Any ideas?

Thanks.

+1  A: 

Since you are using a ViewModel I take it the "action that causes ScrollViewer to load new content" is a result of changes made inside or to the ViewModel. That being the case I would add an event to the ViewModel that gets fired every time such a change occurs.

Your View can the add a handler on this event and call ScrollToVerticalPosition on the ScrollViewer when its fired.

AnthonyWJones