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

ScrollIntoView and BringIntoView do not work

4 Answers 1104 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 03 Feb 2011, 09:25 PM
Hello,

I'm attempting to scroll the selected item into view.  The item is not null.  I have tried the following methods:

mainGrid.ScrollIntoView(mainGrid.SelectedItem);

mainGrid.BringIndexIntoView(mainGrid.Items.IndexOf(mainGrid.SelectedItem));
Dispatcher.BeginInvoke(new Action(() =>  mainGrid.ScrollIntoView(mainGrid.SelectedItem)));
Dispatcher.BeginInvoke(new Action(() =>  mainGrid.BringIndexIntoView(mainGrid.Items.IndexOf(mainGrid.SelectedItem))));


All of the above methods simply scroll my grid a few pixels only and then stop.  All four behave the same way.  If I call all four together, it scrolls (a couple pixels * 4).  Any ideas?

4 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 04 Feb 2011, 02:13 PM
Hi Paul,

I have tested the scenario you described and everything works as expected. I am sending you the sample project I used for reproducing the case. Please take a look at it and let me know in case of any misunderstandings.
 

Kind regards,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Paul
Top achievements
Rank 1
answered on 04 Feb 2011, 03:22 PM
Hello,

Thank you for the response.  Yours works because you do not have a details template.  Add the following XAML to your grid, and set the RowDetailsVisibilityMode to Visible:
<telerik:RadGridView.RowDetailsTemplate>
<DataTemplate>
      <TextBlock Text="WW"/>     </DataTemplate>
</telerik:RadGridView.RowDetailsTemplate>
Now run your application and you'll have the same results as me.
0
Accepted
Maya
Telerik team
answered on 04 Feb 2011, 04:21 PM
Hello Paul,

This behavior is sort of an expected one as once the RowDetails are opened, the calculation of the exact place for scrolling to cannot be calculated correctly. We do make efforts in improving this, but so far no appropriate solution is available. The basic reason is that the RowDetails may be of different height for the different rows, thus making it hard to show the selected item in the visible area.
What can be done is to disable the virtualization (EnableRowVirtualization="False"). However, it may lead to degraded performance in case of big amount of data. The other solution would be not to use RowDetails.

Greetings,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Paul
Top achievements
Rank 1
answered on 04 Feb 2011, 05:26 PM
I will turn off EnableRowVirtualization.  The feature is required so we'll have to deal with any performance issues.  Thanks for the help.
Tags
GridView
Asked by
Paul
Top achievements
Rank 1
Answers by
Maya
Telerik team
Paul
Top achievements
Rank 1
Share this question
or