This is a migrated thread and some comments may be shown as answers.

Edit template scroll issue

2 Answers 18 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
jen
Top achievements
Rank 1
jen asked on 03 Apr 2013, 07:12 PM
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 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 04 Apr 2013, 06:37 AM
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.

0
jen
Top achievements
Rank 1
answered on 04 Apr 2013, 12:56 PM
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();
Tags
DataForm
Asked by
jen
Top achievements
Rank 1
Answers by
Maya
Telerik team
jen
Top achievements
Rank 1
Share this question
or