Click here to Skip to main content
15,867,568 members
Articles / Web Development / XHTML

Silverlight Page Flip Navigation

,
Rate me:
Please Sign up or sign in to vote.
3.14/5 (20 votes)
21 Jul 2009CC (ASA 2.5) 92.9K   3.1K   34   20
It describes page to page navigation with flip animation in Silverlight

Introduction

This article describes how to navigate between pages with flip animation in Silverlight.

Using the Code

The flip animation can be done with the help of PlaneProjection from the namespace System.Windows.Media. You must use the below code snippet in all the XAML pages that needs the flip animation:

XML
<Grid.Projection>
   <PlaneProjection x:Name="Projection"/>
</Grid.Projection>

And in the code base, add a double animation storyboard to flip the page: 

C#
DoubleAnimation daY1 = new DoubleAnimation { From = 0.00, To = 90.00 };
Storyboard.SetTargetName(daY1, "Projection");
Storyboard.SetTargetProperty(daY1, new PropertyPath("RotationX"));
stb1.Children.Add(daY1);
this.Resources.Add("EndOfPage", stb1);
Storyboard stb = new Storyboard();
stb.Duration = new Duration(TimeSpan.FromSeconds(1));
stb.SpeedRatio = 3;
DoubleAnimation daY = new DoubleAnimation { From = -90.00, To = 0.00 };
Storyboard.SetTargetName(daY, "Projection");
Storyboard.SetTargetProperty(daY, new PropertyPath("RotationX"));
stb.Children.Add(daY);
this.Resources.Add("StartOfPage", stb);

And use this method to navigate from page to page:

C#
public void SwitchToPage(UserControl p)
{
    NextPage = p;
    if (CurrentPage != p)
    {
        Storyboard currStb = CurrentPage.Resources["EndOfPage"] as Storyboard;
        currStb.Completed += new EventHandler(currStb_Completed);
        currStb.Begin();
    }
}

History

  • 21st July, 2009: Initial post

License

This article, along with any associated source code and files, is licensed under The Creative Commons Attribution-ShareAlike 2.5 License


Written By
Software Developer iSOFT
India India
Working as a Software Engineer in iSOFT at Chennai, India.

Written By
Software Developer (Senior) iSOFT
India India
Working as a Senior Software Engineer in iSOFT at Chennai, India.

Comments and Discussions

 
BugI need Help with public void SwitchToPage(UserControl p) in vb.net Pin
der22018-Aug-11 20:11
der22018-Aug-11 20:11 
GeneralMy vote of 2 Pin
Michael Eber31-Dec-09 7:51
Michael Eber31-Dec-09 7:51 
GeneralMy vote of 1 Pin
waletzky15-Sep-09 16:20
waletzky15-Sep-09 16:20 
QuestionExcellent Article,but one question! Pin
GomathiR25-Aug-09 1:06
GomathiR25-Aug-09 1:06 
AnswerRe: Excellent Article,but one question! Pin
kamrajj25-Aug-09 3:18
kamrajj25-Aug-09 3:18 
GeneralRe: Excellent Article,but one question! Pin
GomathiR25-Aug-09 20:39
GomathiR25-Aug-09 20:39 
QuestionGood work but i dont know what am I missing Pin
kamrajj24-Aug-09 0:00
kamrajj24-Aug-09 0:00 
Generaldocumentation please Pin
TJDOAD12-Aug-09 11:04
TJDOAD12-Aug-09 11:04 
Generalcool code Pin
forgetuu11-Aug-09 17:54
forgetuu11-Aug-09 17:54 
GeneralMy vote of 1 Pin
positronvx27-Jul-09 22:15
positronvx27-Jul-09 22:15 
GeneralMy vote of 1 Pin
Michael E. Jones27-Jul-09 21:33
Michael E. Jones27-Jul-09 21:33 
GeneralRe: My vote of 1 Pin
jasenschmidt3-Aug-09 19:29
jasenschmidt3-Aug-09 19:29 
GeneralMy vote of 2 Pin
lneir27-Jul-09 15:48
lneir27-Jul-09 15:48 
GeneralCool code, not so cool article Pin
blackjack215021-Jul-09 20:43
blackjack215021-Jul-09 20:43 
Generalexcellent Pin
arun123@poll21-Jul-09 20:23
arun123@poll21-Jul-09 20:23 
GeneralMy vote of 1 Pin
Justin Helsley21-Jul-09 6:15
Justin Helsley21-Jul-09 6:15 
GeneralRe: My vote of 1 Pin
Venkatesan Jagadisan21-Jul-09 7:18
Venkatesan Jagadisan21-Jul-09 7:18 
GeneralMy vote of 2 Pin
Emilio Garavaglia21-Jul-09 2:25
Emilio Garavaglia21-Jul-09 2:25 
GeneralRe: My vote of 2 Pin
Balaji Ganesaan21-Jul-09 19:02
Balaji Ganesaan21-Jul-09 19:02 
GeneralRe: My vote of 2 Pin
Emilio Garavaglia1-Jan-10 4:05
Emilio Garavaglia1-Jan-10 4:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.