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 bt2_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { PinImage test = sender as PinImage; //Grid tmp = test.Parent as Grid; //tmp.Children.Remove(test); //Console.WriteLine(test.Parent.GetType()); DragDrop.DoDragDrop(lvPoint, test, DragDropEffects.Move); }
private void pin_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { pi = sender as PinImage; pi.PreviewMouseMove += pin_MouseMove; }