Exemplo n.º 1
0
        /// <summary>
        /// Handles the application of a new Template.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            PanningTransform = GetTemplateChild(PanningTransformName) as TranslateTransform;

            _animator = PanningTransform != null ? new TransformAnimator(PanningTransform) : null;
        }
Exemplo n.º 2
0
 public static void EnsureAnimator(FrameworkElement targetElement, ref TransformAnimator animator)
 {
     if (animator == null)
     {
         TranslateTransform transform = TransformAnimator.GetTranslateTransform(targetElement);
         if (transform != null)
         {
             animator = new TransformAnimator(transform);
         }
     }
     if (animator == null)
     {
         throw new InvalidOperationException("The animation system could not be prepared for the target element.");
     }
 }