In This Chapter
Assigning element Visibility
based on page orientation
Changing page orientation at runtime
Animation using the VisualStateManager
Page animation using a custom PhoneApplicationFrame
Animating page transitions
Pages in Windows Phone apps can support either the landscape or portrait orientation, or both. When creating a page that supports both orientations, it is prudent to define the UI in XAML in such a way that it produces the layout you want in either orientation without relying on code-beside. Fortunately, XAML’s dynamic layout system makes it easy to build pages that can support both orientations. The Grid
and StackPanel
elements, for example, resize themselves to inhabit available space when the page orientation changes and the dimensions of the page change.
This chapter begins by exploring the properties and events that govern page orientation. You look at using a custom IValueConverter
to hide and display page elements based on the page orientation and at setting the orientation of a page programmatically.
The chapter then looks at animating UI elements when the page orientation changes using the VisualStateManager
and examines how to substitute an application’s RootVisual
with a custom PhoneApplicationFrame
to animate the entire page when the orientation changes.
Finally, the chapter looks at animating page transition using the Windows Phone Toolkit.
18.222.22.216