I have a Silverlight Application that navigates between pages. Somehow the browser seems to remember the last scrolled location of a page, so that when I return to the page, I return to the same location.
For example:
Page 1 has a search list
Page 2 has details with a link at the bottom of the page back to the search list
If Page 2 exceeds the height of the browser, causing vertical scroll bars, when I select a send item from the list on page 1, I’m served up page 2 properly, but scrolled to the bottom of the page where the link was.
How can I get the browser page to navigate back to the top of the page?
Is there a MVVM solution, rather than a javascript solution in the XAML page?are times when I want to location not to change
ScrollViewer wraps two ScrollBar controls for Vertical and Horizontal ScrollBars. The vertical scrollbar has a “Value” property that has a TemplateBinding to VerticalOffset, which i believe is what sets the location. which is a property of the Scrollviewer. Unfortunately, this is not a Dependency property, so you can’t bind to it directly in your VM. The ScrollViewer does have a method named ScrollToVerticalOffset, and there you can specify the location. If you really want the logic in your VM, you could attempt to write a custom Template for ScrollViewer and bind the Value property in your ScrollBar to your Vm.