private void canvasDraw_Drop(object sender, DragEventArgs e) { PinImage test = e.Data.GetData(typeof(PinImage)) as PinImage; //Console.WriteLine(test.Parent.GetType()); Grid testg = test.Parent as Grid; // test.ParentGrid = testg; testg.Children.Remove(test); Console.WriteLine(test.ToolTip); Console.WriteLine(test.Name); test.ToolTip = "A121"; test.Uid = "A121"; test.MouseLeftButtonDown -= bt2_PreviewMouseLeftButtonDown; test.AllowDrop = false; Console.WriteLine(test.AllowDrop); if (test.Parent == null) { test.SetValue(Canvas.LeftProperty, e.GetPosition(canvasDraw).X); test.SetValue(Canvas.TopProperty, e.GetPosition(canvasDraw).Y); canvasDraw.Children.Add(test); } }
private void pin_MouseMove(object sender, MouseEventArgs e) { //PinImage pi = sender as PinImage; Console.WriteLine("mouse move"); pi.SetValue(Canvas.LeftProperty, e.GetPosition(canvasDraw).X - 10); pi.SetValue(Canvas.TopProperty, e.GetPosition(canvasDraw).Y - 10); }