Is this bug in animation? [modified]
-
I have 3 lights and I want they should be placed at some fix positions. So I created a array for location of the lights. readonly Point[] LightLocation = { new Point(50, 50), new Point(300, 50), new Point(550, 50) }; Now if user drags it drop one light to any other light then the previous light animate go to capturing light position. For some reason it does not work. I thought every time when I drop any light I reset all the light, but this also does not work. It looks code is bit long for code block. If someone send me email I will be able to send the code. agha.khan@hotmail.com Agha Khan ;) //// TrafficLight.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Windows.Media.Effects; namespace CanvasTest { public class TrafficLight : Canvas { public static readonly DependencyProperty ColorProperty = DependencyProperty.Register("LightColor", typeof(Color), typeof(TrafficLight), new FrameworkPropertyMetadata( Colors.Red, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender)); public static readonly DependencyProperty IDProperty = DependencyProperty.Register("LightID", typeof(string), typeof(TrafficLight), new FrameworkPropertyMetadata( "", FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender)); static readonly Size sizeLight = new Size(130, 130); DrawingVisual Arround = null; DrawingVisual Middle = null; public Color LightColor { set { SetValue(ColorProperty, value); } get { return (Color)GetValue(ColorProperty); } } public string LightID { set { SetValue(IDProperty, value); } get { return (string)GetValue(IDProperty); } } static TrafficLight() { DefaultStyleKeyProperty.OverrideMetadata(typeof(TrafficLight), new FrameworkPropertyMetadata(typeof(TrafficLight))); } public TrafficLight() { Arround = new DrawingVisual(); Middle = new DrawingVisual(); BuildLight(); AddVis