Edit template scroll issue

3 posts, 0 answers
  1. jen
    jen avatar
    63 posts
    Member since:
    Jun 2009

    Posted 03 Apr 2013 Link to this post

    I'm having an issue with the scroll position of my edit template.

    When my edit template is longer than the dataform, the scrollbar appears. However, if i edit an object, scroll the template to the bottom then end the edit, the next time I enter edit mode the template is still scrolled down to the bottom.

    How do I make sure that each time I enter edit mode, the template is scrolled back to the top?
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 04 Apr 2013 Link to this post

    Hello Jen,

    That would be the expected behavior since the scroll bar that you see are a part of the data form as a whole, not just the edit template.
    What you can try is to handle BeginningEdit event, find the ScrollViewer and change its offsets so that it scroll to the beginning. It could be something like:

    var scrollViewer = this.radGridView.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault();
       
    scrollViewer.ScrollToVerticalOffset(0);
     

    Regards,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. jen
    jen avatar
    63 posts
    Member since:
    Jun 2009

    Posted 04 Apr 2013 Link to this post

    Thank you Maya, that got me on the right track.
    The code you gave didn't work, but this did:

    var scrollViewer = this.RadGridView.ChildrenOfType<ScrollViewer>().FirstOrDefault();
    scrollViewer.ScrollToTop();
Back to Top