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

Bug? ScrollIntoView doesn't look upwards

9 Answers 192 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Oleg
Top achievements
Rank 1
Oleg asked on 24 Jan 2012, 06:36 PM
Hello,

Looks like ScrollIntoView doesn't do anything if the grid is scrolled down to the bottom and the item to be displayed is at the top (out of view). Is it a bug or I've messed something up in my project?

Regards,
Oleg

9 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 25 Jan 2012, 11:04 AM
Hi,

 I have tested such a scenario and the GridView was scrolled up right to the item displayed at the top.
According to this thread you use the 2011.3.1220 version of the RadControls. Can you please confirm that?
 

All the best,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Oleg
Top achievements
Rank 1
answered on 25 Jan 2012, 03:50 PM
Didie, that's right, I'm using version 2011.3.1220. If you say it should work then I'll have to build a sample project. I'm actually observing a bunch of issues related to virtualization and paging and I thought scrolling was one of them.
0
Sebastian
Top achievements
Rank 1
answered on 29 Mar 2012, 10:20 AM
Hi,

I am actually having some issues with scrolling upwards with the ScrollIntoViewAsync.
It works if the item I am trying to scroll to is out of view considerably but not when it is only 10 rows out of sight.

This means that I am getting a gap in the scrolling function upwards, however downwards it works fine.

Any advice setting some properties like Height on the grid for instance?
I am using Telerik version 2012.1.0215.1040.

Please advice.

Regards,
Sebastian
0
Dimitrina
Telerik team
answered on 30 Mar 2012, 01:48 PM
Hi,

 I have tested scrolling to an item upwards. The item was brought into view.

When I read through your text, I am not sure that I understand this line "gap in the scrolling function upwards". Would you please show me a screenshot or send me a small test project to illustrate this "gap"?  

Kind regards,
Didie
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Sebastian
Top achievements
Rank 1
answered on 10 Apr 2012, 11:01 AM
Hi,

The "gap" I am referring to is the items in the middle are the rows that the ScrollIntoViewAsync method will consider as in view while they are not visible in the UI.

I tracked my problem down to the following method:
IScrollContentElement.IsInViewport

Which returns true even when the item is not showing.

I choose to go with another solution since I also need the item that is being scrolledintoview to be centered in the UI.
var focusElement = GetElementToScrollTo();
var datarow = focusElement.ParentOfType<Telerik.Windows.Controls.GridView.GridViewRow>();
var scrollBar = grid.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault();
 
double gridCenter = grid.ActualHeight / 2;
var transform = focusElement.TransformToVisual(grid as UIElement);
var myUiElementPosition = transform.Transform(new Point(0, 0));
 
double scrollAmount = myUiElementPosition.Y - gridCenter;
//Debug.WriteLine("Diff from center:" + scrollAmount.ToString());
//Debug.WriteLine("Scrolling to:" + (scrollBar.VerticalOffset + scrollAmount).ToString());
scrollBar.ScrollToVerticalOffset(scrollBar.VerticalOffset + scrollAmount);

Hope that could help someone else.

//Sebastian
0
Dimitrina
Telerik team
answered on 12 Apr 2012, 10:29 AM
Hi,

I am glad to hear that you have found a solution for your case.

 I am still not able to scroll the item out of View. Could you please attach a screenshot describing the "gap"? 

All the best,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Christophe
Top achievements
Rank 1
answered on 19 Dec 2012, 05:26 PM
Hi,

I have the same problem and noticed all the behaviors described by Sebastian. I use version 2012.1.326 and EnableRowVirtualization is false. My grid is embeded in a RadPane docked at the bottom of my app and I noticed that the gap (described by Sebastian) is smaller when my pane/grid is smaller. The gap is approximately equal to the height of the grid (a little smaller).

Have you found a solution yet other than the one provided by Sebastian?

Christophe
0
Dimitrina
Telerik team
answered on 21 Dec 2012, 10:26 AM
Hello,

Do you meet the same problem when the GridView is not embedded in a RadPane? Have you also tested with our most recent version - 2012 Q3 SP? If you can still reproduce the problem, then may I ask you to please open a support ticket sending us a demo project showing the exact case you have?

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Christophe
Top achievements
Rank 1
answered on 21 Dec 2012, 04:29 PM
It works with version 2012 Q3. Thank you.
Tags
GridView
Asked by
Oleg
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Oleg
Top achievements
Rank 1
Sebastian
Top achievements
Rank 1
Christophe
Top achievements
Rank 1
Share this question
or