private bool getItem(Point p)
 {
     Core.ToolBox.Tool hovering = mainBuilder.InputHitTest(p) as Core.ToolBox.Tool;
     if (hovering != null)
     {
         MessageBox.Show(hovering.GetType().ToString());
     }
     return(true);
 }
 private void mainBuilder_Drop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent("myFormat"))
     {
         Point             p         = e.GetPosition(mainBuilder);
         Core.ToolBox.Tool tool      = e.Data.GetData("myFormat") as Core.ToolBox.Tool;
         TreeView          treeView  = sender as TreeView;
         builderItem       itemToAdd = new builderItem();
         itemToAdd.builderTool = tool;
         itemToAdd.Header      = tool.toolHeader;
         treeView.Items.Add(itemToAdd);
     }
 }
        private void toolsBox_MouseMove(object sender, MouseEventArgs e)
        {
            Point  mousePos = e.GetPosition(null);
            Vector diff     = startPoint - mousePos;

            if (e.LeftButton == MouseButtonState.Pressed)
            {
                if (Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance || Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance)
                {
                    ListView     listView = sender as ListView;
                    ListViewItem Tool     = FindAnchestor <ListViewItem>((DependencyObject)e.OriginalSource);

                    Core.ToolBox.Tool dragTool = (Core.ToolBox.Tool)listView.ItemContainerGenerator.ItemFromContainer(Tool);

                    DataObject dragData = new DataObject("myFormat", dragTool);
                    DragDrop.DoDragDrop(Tool, dragData, DragDropEffects.Copy | DragDropEffects.Move);
                }
            }
        }
 public builderItem()
 {
     builderTool = new Core.ToolBox.Tool(null, null, null, null);
 }