1

<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" > <StackPanel Orientation="Horizontal"> <control:TileGroupControl DataContext="{Binding Path=BeraterGroup}" DataTemplateSelector="{StaticResource beraterDataTemplateSelector}" Margin="25,15,15,20" /> <control:TileGroupControl DataContext="{Binding Path=AufgabenGroup}" DataTemplateSelector="{StaticResource beraterDataTemplateSelector}" Margin="15,15,15,20" /> <control:TileGroupControl DataContext="{Binding Path=KundenGroup}" DataTemplateSelector="{StaticResource beraterDataTemplateSelector}" Margin="15,15,15,20" /> <control:TileGroupControl DataContext="{Binding Path=GespraecheGroup}" DataTemplateSelector="{StaticResource beraterDataTemplateSelector}" Margin="15,15,15,20" /> </StackPanel> </ScrollViewer>

I've got a XAML ScrollViewer with some different Datagroups in it and would like to start the ScrollViewer position not at the beginning of the ScrollViewer, but at the second group. Does anybody know, how to realize this?

Thanks, Cora

Picture what i want

  • just have a look at http://stackoverflow.com/questions/2946954/make-listview-scrollintoview-scroll-the-item-into-the-center-of-the-listview-c – Justin CI Apr 27 '15 at 10:06

1 Answers1

0

I'm not sure if I understand what you want to do. If you want to move the scroll you can use this method:

ScrollViewer.ScrollToHorizontalOffset(double d)
Nacho
  • 65
  • 8
  • yes i tried, but it doesn't work... there is also a method ChangeView(horizontal offset, vertical offset, zoomfactor), but it also doesn't work. – user3800725 Jul 03 '14 at 09:47
  • Could it be the problem, that the ScrollableHeight=0? How can i change it? – user3800725 Jul 03 '14 at 09:59
  • Maybe you set the offset too soon. The stack panel can change size according with the controls width. If you set the horizontal offset before the stackpanel has the correct size it won´t work. – Nacho Jul 03 '14 at 10:01