William Bergendahl
William Bergendahl

Reputation: 115

Windows Phone NavigationService jumps

I have some xaml pages let's call them 1,2,3 etc..

When navigating from 1 to 2 the whole page jumps up a bit when loading the page and then returns to normal, same thing happens if navigating from 2 to 3.

Though when navigating backwards with the navigationservice.GoBack(); method, from page3 to page2 or page2 to page1 the page transitions are all smooth with no jumps in between.

The jumps im experiencing are only occuring when navigating forwards what could be the problem since it's quite a bit annoying and i would like to fix this.

Example of how im navigating forward:

NavigationService.Navigate(new Uri("/page2.xaml", UriKind.Relative));

Xaml layout:

<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>

Upvotes: 1

Views: 670

Answers (1)

Den
Den

Reputation: 16826

Are you testing this on a physical device or an emulator? What version of the SDK/OS are you using?

I've never experienced this problem before personally, however, from what I remember seeing as a solution to this problem from a few developers that had it was forcing the navigation push (NavigationService.Navigate) through the core dispatcher.

Basically:

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

Upvotes: 1

Related Questions