Exemplo n.º 1
0
        /// <internalonly />
        protected internal override ProceduralAnimation CreateEffectAnimation(EffectDirection direction)
        {
            SolidColorBrush brush;

            FrameworkElement target = GetTarget();

            Border  border  = target as Border;
            Panel   panel   = target as Panel;
            Control control = target as Control;

            if ((border == null) && (panel == null) && (control == null))
            {
                throw new InvalidOperationException("The target of the effect must be a Panel, Border or Control.");
            }

            brush = new SolidColorBrush(_highlightColor);
            if (border != null)
            {
                border.Background = brush;
            }
            else if (panel != null)
            {
                panel.Background = brush;
            }
            else if (control != null)
            {
                control.Background = brush;
            }

            HighlightAnimation animation = new HighlightAnimation(Duration, brush, _highlightColor);

            animation.AutoReverse   = AutoReverse;
            animation.Interpolation = GetEffectiveInterpolation();

            return(animation);
        }
Exemplo n.º 2
0
        /// <internalonly />
        protected internal override ProceduralAnimation CreateEffectAnimation(AnimationEffectDirection direction)
        {
            SolidColorBrush brush;

            FrameworkElement target = GetTarget();

            Border border = target as Border;
            Panel panel = target as Panel;
            Control control = target as Control;

            if ((border == null) && (panel == null) && (control == null)) {
                throw new InvalidOperationException("The target of the effect must be a Panel, Border or Control.");
            }

            brush = new SolidColorBrush(_highlightColor);
            if (border != null) {
                border.Background = brush;
            }
            else if (panel != null) {
                panel.Background = brush;
            }
            else if (control != null) {
                control.Background = brush;
            }

            HighlightAnimation animation = new HighlightAnimation(Duration, brush, _highlightColor);
            animation.AutoReverse = AutoReverse;
            animation.Interpolation = GetEffectiveInterpolation();

            return animation;
        }