WP7 Application Development Notes (12) add page Animation

Source: Internet
Author: User

Page animation is the excessive animation effect of page switching.

In normal times, system programs that use WP mobile phones have the same excessive effect as page flip. I am going to complete the simple addition below.

 

Use Windows Phone Toolkit

In fact, this animation effect does not need to be implemented by ourselves. The Windows Phone toolkit has encapsulated the ready-made library, and we only need to call it.

Here you can download:

Http://silverlight.codeplex.com/

After installation, you can find [32-bit system remove (x86)] in c: \ Program Files (x86) \ microsoft sdks \ Windows Phone \ v7.1 \ toolkit.

You can reference it to the project. There are many enhancement controls that are also very practical. I believe you have used them.

However, transitionservice. navigationintransition is used here.

 

Add excessive effects to the page

Step 1: there must be an indispensable preparationIn app. XAML. CS.

Locate rootframe = new phoneapplicationframe ();

Replace with rootframe = new transitionframe ();

 

Step 2: add the effect code on the page

First add the namespace xmlns: Toolkit = "CLR-namespace: Microsoft. Phone. controls; Assembly = Microsoft. Phone. Controls. toolkit"

 

Then add the <Phone: phoneapplicationpage> element

 

<toolkit:TransitionService.NavigationInTransition>
<toolkit:NavigationInTransition>
<toolkit:NavigationInTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardIn"/>
</toolkit:NavigationInTransition.Backward>
<toolkit:NavigationInTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardIn"/>
</toolkit:NavigationInTransition.Forward>
</toolkit:NavigationInTransition>
</toolkit:TransitionService.NavigationInTransition>
<toolkit:TransitionService.NavigationOutTransition>
<toolkit:NavigationOutTransition>
<toolkit:NavigationOutTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardOut"/>
</toolkit:NavigationOutTransition.Backward>
<toolkit:NavigationOutTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardOut"/>
</toolkit:NavigationOutTransition.Forward>
</toolkit:NavigationOutTransition>
</toolkit:TransitionService.NavigationOutTransition>

 

OK completes the page flip animation in two simple steps.

Toolkit provides many animation effects in Microsoft. Phone. Controls. Toolkit \ transitions,

You can also inherit the transitionelement to implement your own animation.

However, I think the default turnstiletransition is the most satisfactory, and it is too dazzling to affect the use.

 

Use excessive effects as page styles

If there are many pages on which each page requires an effect, you can add the effect as a style to the system resource file or directly write it in APP. XAML.

The method is also simple.

 

<Application.Resources>
<Style x:Key="TransitionPageStyle" TargetType="phone:PhoneApplicationPage">
<Setter Property="toolkit:TransitionService.NavigationInTransition">
<Setter.Value>
<toolkit:NavigationInTransition>
<toolkit:NavigationInTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardIn"/>
</toolkit:NavigationInTransition.Backward>
<toolkit:NavigationInTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardIn"/>
</toolkit:NavigationInTransition.Forward>
</toolkit:NavigationInTransition>
</Setter.Value>
</Setter>
<Setter Property="toolkit:TransitionService.NavigationOutTransition">
<Setter.Value>
<toolkit:NavigationOutTransition>
<toolkit:NavigationOutTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardOut"/>
</toolkit:NavigationOutTransition.Backward>
<toolkit:NavigationOutTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardOut"/>
</toolkit:NavigationOutTransition.Forward>
</toolkit:NavigationOutTransition>
</Setter.Value>
</Setter>
</Style>
</Application.Resources>

Add a property style = "{staticresource transitionpagestyle}" to the page for the effect.

Page animation is the excessive animation effect of page switching.

In normal times, system programs that use WP mobile phones have the same excessive effect as page flip. I am going to complete the simple addition below.

 

Use Windows Phone Toolkit

In fact, this animation effect does not need to be implemented by ourselves. The Windows Phone toolkit has encapsulated the ready-made library, and we only need to call it.

Here you can download:

Http://silverlight.codeplex.com/

After installation, you can find [32-bit system remove (x86)] in c: \ Program Files (x86) \ microsoft sdks \ Windows Phone \ v7.1 \ toolkit.

You can reference it to the project. There are many enhancement controls that are also very practical. I believe you have used them.

However, transitionservice. navigationintransition is used here.

 

Add excessive effects to the page

Step 1: there must be an indispensable preparationIn app. XAML. CS.

Locate rootframe = new phoneapplicationframe ();

Replace with rootframe = new transitionframe ();

 

Step 2: add the effect code on the page

First add the namespace xmlns: Toolkit = "CLR-namespace: Microsoft. Phone. controls; Assembly = Microsoft. Phone. Controls. toolkit"

 

Then add the <Phone: phoneapplicationpage> element

 

<toolkit:TransitionService.NavigationInTransition>
<toolkit:NavigationInTransition>
<toolkit:NavigationInTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardIn"/>
</toolkit:NavigationInTransition.Backward>
<toolkit:NavigationInTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardIn"/>
</toolkit:NavigationInTransition.Forward>
</toolkit:NavigationInTransition>
</toolkit:TransitionService.NavigationInTransition>
<toolkit:TransitionService.NavigationOutTransition>
<toolkit:NavigationOutTransition>
<toolkit:NavigationOutTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardOut"/>
</toolkit:NavigationOutTransition.Backward>
<toolkit:NavigationOutTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardOut"/>
</toolkit:NavigationOutTransition.Forward>
</toolkit:NavigationOutTransition>
</toolkit:TransitionService.NavigationOutTransition>

 

OK completes the page flip animation in two simple steps.

Toolkit provides many animation effects in Microsoft. Phone. Controls. Toolkit \ transitions,

You can also inherit the transitionelement to implement your own animation.

However, I think the default turnstiletransition is the most satisfactory, and it is too dazzling to affect the use.

 

Use excessive effects as page styles

If there are many pages on which each page requires an effect, you can add the effect as a style to the system resource file or directly write it in APP. XAML.

The method is also simple.

 

<Application.Resources>
<Style x:Key="TransitionPageStyle" TargetType="phone:PhoneApplicationPage">
<Setter Property="toolkit:TransitionService.NavigationInTransition">
<Setter.Value>
<toolkit:NavigationInTransition>
<toolkit:NavigationInTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardIn"/>
</toolkit:NavigationInTransition.Backward>
<toolkit:NavigationInTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardIn"/>
</toolkit:NavigationInTransition.Forward>
</toolkit:NavigationInTransition>
</Setter.Value>
</Setter>
<Setter Property="toolkit:TransitionService.NavigationOutTransition">
<Setter.Value>
<toolkit:NavigationOutTransition>
<toolkit:NavigationOutTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardOut"/>
</toolkit:NavigationOutTransition.Backward>
<toolkit:NavigationOutTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardOut"/>
</toolkit:NavigationOutTransition.Forward>
</toolkit:NavigationOutTransition>
</Setter.Value>
</Setter>
</Style>
</Application.Resources>

Add a property style = "{staticresource transitionpagestyle}" to the page for the effect.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.