簡體   English   中英

Windows Phone NavigationService跳轉

[英]Windows Phone NavigationService jumps

我有一些xaml頁面,我們稱它們為1,2,3等。

從1導航到2時,整個頁面在加載頁面時會跳一點,然后返回正常狀態;如果從2導航到3,也會發生相同的情況。

盡管使用navigationservice.GoBack()向后導航時, 方法,從第3頁到第2頁,或從第2頁到第1頁,頁面過渡都很流暢,中間沒有跳轉。

我遇到的跳躍僅在向前導航可能是問題時才會發生,因為這很煩人,我想解決這個問題。

如何向前導航的示例:

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>

您是在物理設備還是仿真器上進行測試? 您正在使用哪個版本的SDK / OS?

但是,我以前從未親身經歷過此問題,據我記得,當時有一些開發人員通過強制通過核心調度程序強制導航推送( NavigationService.Navigate )來解決此問題。

基本上:

Dispatcher.BeginInvoke(() =>
    {
        NavigationService.Navigate(new Uri("/Page1.xaml", UriKind.Relative));
    });

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM