private void AnimateButtons(OrientationChangedEventArgs e)
{
// check if a new orientation is landscape or portrait
if (e.Orientation == PageOrientation.Landscape || e.Orientation == PageOrientation.LandscapeLeft || e.Orientation == PageOrientation.LandscapeRight) {
// align "Light" button to the left
mLightButton.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
// align "Cancel" button to the bottom
mCancelButton.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
// start the portrait to landscape animation
mP2LAnimation.Begin();
} else {
// align "Light" button to the right
mLightButton.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
// align "Cancel" button to the top
mCancelButton.VerticalAlignment = System.Windows.VerticalAlignment.Top;
// start the landscape to portrait animation
mL2PAnimation.Begin();
}
}