Exemplo n.º 1
0
        /// <inheritdoc />
        public void Animate(
            IAnimationContext context,
            System.Windows.Controls.Control control,
            double x,
            double y,
            TimeSpan duration)
        {
            if (!double.IsNaN(x))
            {
                double from = GraphCanvas.GetX(control);
                from = double.IsNaN(from) ? 0.0 : from;

                // Create the animation for the horizontal position
                var animationX = new DoubleAnimation(
                    from,
                    x,
                    duration,
                    FillBehavior.HoldEnd);
                animationX.Completed += (s, e) =>
                {
                    control.BeginAnimation(GraphCanvas.XProperty, null);
                    control.SetValue(GraphCanvas.XProperty, x);
                };
                control.BeginAnimation(GraphCanvas.XProperty, animationX, HandoffBehavior.Compose);
            }

            if (!double.IsNaN(y))
            {
                double from = GraphCanvas.GetY(control);
                from = (double.IsNaN(from) ? 0.0 : from);

                // Create an animation for the vertical position
                var animationY = new DoubleAnimation(
                    from, y,
                    duration,
                    FillBehavior.HoldEnd);
                animationY.Completed += (s, e) =>
                {
                    control.BeginAnimation(GraphCanvas.YProperty, null);
                    control.SetValue(GraphCanvas.YProperty, y);
                };
                control.BeginAnimation(GraphCanvas.YProperty, animationY, HandoffBehavior.Compose);
            }
        }
Exemplo n.º 2
0
 public static void InitLoadUnloadState(System.Windows.Controls.Control control, DependencyPropertyKey isLoadedProperty)
 {
     control.Loaded   += (sender, args) => control.SetValue(isLoadedProperty, KnownBoxes.BoolTrue);
     control.Unloaded += (sender, args) => control.SetValue(isLoadedProperty, KnownBoxes.BoolFalse);
 }
Exemplo n.º 3
0
 public static void InitIsMouseOverState(System.Windows.Controls.Control control, DependencyPropertyKey isMouseOverProperty)
 {
     control.MouseEnter += (sender, args) => control.SetValue(isMouseOverProperty, KnownBoxes.BoolTrue);
     control.MouseLeave += (sender, args) => control.SetValue(isMouseOverProperty, KnownBoxes.BoolFalse);
 }
Exemplo n.º 4
0
 public static void InitFocusChangedState(System.Windows.Controls.Control control, DependencyPropertyKey isFocusedProperty)
 {
     control.GotFocus  += (sender, args) => control.SetValue(isFocusedProperty, KnownBoxes.BoolTrue);
     control.LostFocus += (sender, args) => control.SetValue(isFocusedProperty, KnownBoxes.BoolFalse);
 }
 public static void SetDoubleClickCommandParameter(System.Windows.Controls.Control element, object Value)
 {
     element.SetValue(DoubleClickCommandParameterProperty, Value);
 }
 private static void SetDoubleClickCommandWeakEventListener(System.Windows.Controls.Control element, IWeakEventListener Value)
 {
     element.SetValue(DoubleClickCommandWeakEventListenerProperty, Value);
 }
 public static void SetDoubleClickCommand(System.Windows.Controls.Control element, ICommand Value)
 {
     element.SetValue(DoubleClickCommandProperty, Value);
 }
Exemplo n.º 8
0
 public void SetValue(System.Windows.Controls.Control sender, System.Windows.DependencyProperty property)
 {
     sender.SetValue(property, this.ReadOnly);
 }