wp wp8: page transitions page transitions

First import the Toolkit.dll

file and modify the RootFrame in the InitializePhoneApplication() function in App.xaml.cs
RootFrame=new TransitionFrame();

import xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone .Controls.Toolkit"

code:

Slide.xaml

<phone:PhoneApplicationPage
    x:Class="wp8Transaction.Slide"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x=" http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone. Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft. com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="True"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    >

    <!--LayoutRoot 是包含所有页面内容的根网格-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the application's name and page title-->
        <StackPanel Grid.Row="0" Margin="12,17,0,28 ">
            <TextBlock Text="My Application" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock Text="Page Name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" />
        </StackPanel>

        <!--ContentPanel - put additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">

        < /Grid>
    </Grid>

    <toolkit: TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:SlideTransition  Mode="SlideDownFadeIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:SlideTransition Mode="SlideRightFadeIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:SlideTransition Mode="SlideLeftFadeOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:SlideTransition Mode="SlideUpFadeOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>

</phone:PhoneApplicationPage>



The following methods are visible To sliding effect

private void slideClick(object sender, RoutedEventArgs arg)
        {
            NavigationService.Navigate(new Uri("/Slide.xaml", UriKind.Relative));
        }


About custom transition

ITransition interface implements this interface to override GetTransition method

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326355930&siteId=291194637