我有一些 xaml 页面,我们称它们为 1、2、3 等。
当从 1 导航到 2 时,整个页面在加载页面时会向上跳一点,然后恢复正常,如果从 2 导航到 3,也会发生同样的情况。
虽然使用 navigationservice.GoBack(); 向后导航时 方法,从 page3 到 page2 或 page2 到 page1 页面转换都是平滑的,中间没有跳转。
我遇到的跳跃只会在向前导航时发生,这可能是问题所在,因为它有点烦人,我想解决这个问题。
我如何向前导航的示例:
NavigationService.Navigate(new Uri("/page2.xaml", UriKind.Relative));
Xaml 布局:
<Grid x:Name="LayoutRoot">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="Blablabla secret" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="More blablabla" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<ScrollViewer Height="500" HorizontalAlignment="Left" Margin="18,0,0,0" Name="scrollViewer1" VerticalAlignment="Top" Width="450" HorizontalScrollBarVisibility="Disabled" Grid.Row="1">
<StackPanel Height="Auto" Name="stackPanel1" Width="450">
<TextBlock Height="54" Name="textBlock1" Text="" TextWrapping="Wrap">
<Underline FontSize="40">page2</Underline>
</TextBlock>
<TextBlock Height="400" Name="textBlock2" Text="Blablablabla" TextWrapping="Wrap" FontSize="26" />
</StackPanel>
</ScrollViewer>
<my:AdControl AdUnitId="000000" ApplicationId="ffffff" Grid.Row="1" Height="80" HorizontalAlignment="Left" Margin="0,455,0,0" Name="adControl1" VerticalAlignment="Top" Width="480" />
<Grid.Background>
<ImageBrush ImageSource="/Blablaapplication;component/Images/Secret.png" />
</Grid.Background>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
<shell:ApplicationBarIconButton IconUri="/Images/appbar.Back.rest.png" Text="Back" Click="Backbutton"/>
<shell:ApplicationBarIconButton IconUri="/Images/appbar.next.rest.png" Text="Next" Click="Nextbutton"/>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>