1

What i want is to scroll gridview to selected item .

i tried the following but doesn't work

 Tumbnailsgrid.SelectedIndex = Mainflipview.SelectedIndex;
 var scrollBar = Tumbnailsgrid.GetFirstDescendantOfType<ScrollViewer>();
 scrollBar.ChangeView((double)Tumbnailsgrid.SelectedIndex / tumbnailimagelist.Count,   scrollBar.VerticalOffset,1,true);
suvish valsan
  • 859
  • 12
  • 30

3 Answers3

1

finally worked with MakeVisible method code follows

 Tumbnailsgrid.SelectedIndex = Mainflipview.SelectedIndex;
 var zoomLoc = new SemanticZoomLocation() { Item = Tumbnailsgrid.SelectedItem };
 Tumbnailsgrid.MakeVisible(zoomLoc);
suvish valsan
  • 859
  • 12
  • 30
  • Here's my question: http://stackoverflow.com/questions/29841841/calculate-horizontal-offset-to-scroll-listview-to-the-center-of-the-selecteditem I tried your answer here, but when I flip many times the `FlipView`, and return to check my `ListView`, I see that it didn't scroll to the `selectedItem`! Any idea what I'm doing wrong? – yalematta Apr 27 '15 at 09:07
0

I didn't test but what about Tumbnailsgrid.ScrollIntoView(Tumbnailsgrid.SelectedItem); ?

vincenty
  • 36
  • 3
0

Try this, it worked for me:

Tumbnailsgrid.UpdateLayout(); 
Tumbnailsgrid.ScrollIntoView(Tumbnailsgrid.SelectedItem);
Lgn
  • 9,581
  • 5
  • 20
  • 26