0

I am working on a user control using MVVM architectural style and facing an issue while using the scroll viewer.
Whenever I open the user control, I find the scroll Viewer at the same position where I left it last time. I want that whenever I open the control I should get the scroll viewer at the top position.

<ScrollViewer VerticalAlignment="Stretch" HorizontalAlignment="Stretch" HorizontalScrollBarVisibility="Visible">

Please help me with any kind of solution.

Vikas
  • 158
  • 15
  • At the constructor of your user control call a method/event and set these ScrollViewer.ScrollToTop(); ScrollViewer.UpdateLayout(); – CodeConstruct Mar 11 '16 at 06:58
  • Check out this link, http://stackoverflow.com/questions/8370209/how-to-scroll-to-the-bottom-of-a-scrollviewer-automatically-with-xaml-and-bindin/8372627#8372627 – Arun Selva Kumar Mar 14 '16 at 12:39

1 Answers1

0

You can use the following code to move the scrollviewer postion to top

ScrollViewer scroll = //FindyourScrollViewerControlHere

scroll.ScrollToTop();

Use the following approach, if you want the scrolling using XAML and binding

https://stackoverflow.com/a/8372627/1612065

Community
  • 1
  • 1
Anees Deen
  • 1,385
  • 2
  • 17
  • 31