2014-12-26 29 views

回答

1

是的,你可以使用HubName.ScrollToSection(HubSectionName);

MSDN: Hub.ScrollToSection method

小例子

<Hub x:Name="myHub"> 
    <HubSection x:Name="myHubSection"> 
     <DataTemplate> 
      <Grid Width="2000" Height="1000"> 
       <TextBlock Text="hi"></TextBlock> 
       <Button Content="ScrollToNext" VerticalAlignment="Bottom" Click="Button_Click"></Button> 
      </Grid> 
     </DataTemplate> 
    </HubSection> 
    <HubSection x:Name="myHubSection2"> 
     <DataTemplate> 
      <Grid Width="900"> 
       <TextBlock Text="hi2"></TextBlock> 
      </Grid> 
     </DataTemplate> 
    </HubSection>    
</Hub> 

// this will scroll to myHubSection2 
private void Button_Click(object sender, RoutedEventArgs e) 
{ 
    this.myHub.ScrollToSection(this.myHubSection2); 
} 
+0

还有一种方法来改变HubSection更慢? – prova2

+1

@ prova2 ofcourse,参见:https://social.msdn.microsoft.com/Forums/windowsapps/en-US/1b667e9e-012c-4688-9711-87230337a621/making-the-windows-8-hub-control-scroll - 更好的程序化的手势?论坛= winappswithcsharp –

相关问题