/// <summary>
 /// Sets the PageRotationAnimation Attached Property for the provided DependencyObject.
 /// </summary>
 /// <param name="obj">The DependencyObject whose PageRotationAnimation you would like to set.</param>
 /// <param name="value">The PageRotationAnimation you would like to set to the provided DependencyObject.</param>
 public static void SetPageRotationAnimation(DependencyObject obj, PageRotationAnimation value)
 {
     if (null == obj)
     {
         throw new ArgumentNullException("obj");
     }
     obj.SetValue(PageRotationAnimationProperty, value);
 }
 /// <summary>
 /// Gets a PageRotationAnimation property for the provided DependencyObject, creates a new one if necessary.
 /// </summary>
 /// <param name="obj">The DependencyObject whose PageRotationAnimation you would like to get.</param>
 /// <returns>The PageRotationAnimation associated with the provided DependencyObject</returns>
 public static PageRotationAnimation GetPageRotationAnimation(DependencyObject obj)
 {
     if (null == obj)
     {
         throw new ArgumentNullException("obj");
     }
     else
     {
         PageRotationAnimation animation =
             (obj.GetValue(PageRotationAnimationProperty) as PageRotationAnimation) ?? new PageRotationAnimation();
         obj.SetValue(PageRotationAnimationProperty, animation);
         return(animation);
     }
 }
        /// <summary>
        /// Handles changes to the PageRotationAnimation DependencyProperty.
        /// </summary>
        /// <param name="o">DependencyObject that changed.</param>
        /// <param name="e">Event data for the DependencyPropertyChangedEvent.</param>
        private static void OnPageRotationAnimationChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            FrameworkElement target = o as FrameworkElement;

            if (null != target)
            {
                PageRotationAnimation animation = e.NewValue as PageRotationAnimation;
                if (null != animation)
                {
                    animation.Target = target;
                }
                else
                {
                    throw new InvalidOperationException("The content of a PageRotationService must be a PageRotationAnimation.");
                }
            }
            else
            {
                throw new ArgumentNullException("o");
            }
        }