Reusing the Transition Attached Properties

The transition attached properties are rather verbose, and adding them to every page in your app adds a substantial amount of duplication. Fortunately you can create a reusable style that can be applied to each page.

Listing 4.4 shows a style called TransitionPageStyle, whose TargetType is of PhoneApplicationPage. The transition properties are placed within the style, so that when the style is applied to a page, so too are the navigation transition properties.

LISTING 4.4. TransitionPageStyle in App.xaml

<Application.Resources>    <Style x:Key="TransitionPageStyle" TargetType="phone:PhoneApplicationPage">        <Setter Property="toolkit:TransitionService.NavigationInTransition"> ...

Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.