November 9 2010
So you want your Windows Phone 7 application to have nifty transitions similar to how the native apps on the phone work. Most commonly you see the turnstile effect or the slide effect.
With the Silverlight Toolkit for Windows Phone, it is pretty darned easy. Download sample code. Here’s how:
- Download and install the toolkit. It gets installed to C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Toolkit\Nov10\Bin\Microsoft.Phone.Controls.Toolkit.dll if you were wondering. It should automatically appear as an option as Microsoft.Phone.Controls.Toolkit when you go to add a reference.
- Change your app.xaml.cs file in the InitializePhoneApplication() method so that RootFrame is of type TransitionFrame:
- Then, under the root element of each page (which should be <phone:PhoneApplicationPage> add the transition you want. You'll need to add the xmlns to dll, like this: xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
- If you want Turnstile transtion, it would look like this:
- If you want Slide transitions, it would look like this:
And that’s it! You can also play around with the other transition modes supported, which are roll, swivel and rotate.
Download sample code.