【发布时间】:2013-03-12 10:07:45
【问题描述】:
我有一些 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>
【问题讨论】:
-
您需要展示一些xaml,以便我们了解各个页面的布局。
-
@Gambit 现在编辑并包含 xaml 代码! :)
-
我无法重现您所描述的内容,但发现这可能会有所帮助:softwarenerd.org/archives/449
-
听起来像是描述我的问题的好来源!我调查一下。 :) 我认为这是我在每个页面上的应用程序栏弄乱了它,我仔细查看了在我的物理设备上运行它,并慢慢注意到它正在为每个页面重新加载应用程序栏,从而使整个页面上升一秒钟。我会试试这些方法! :)
标签: c# visual-studio-2010 windows-phone-7