コード例 #1
0
 void DetachIcon()
 {
     if (isMouseDown)
     {
         AssociatedObject.MouseMove  -= AssociatedObject_MouseMove;
         AssociatedObject.MouseLeave -= AssociatedObject_MouseLeave;
         itemsControl = FrameworkHelper.GetParent <ItemsControl>(AssociatedObject);
         MouseManager.Manager.MouseMoved += Manager_MouseMoved;
         icon = (IconViewModel)AssociatedObject.DataContext;
         VMLocator.Main.Icons.Remove(icon);
         if (draggedIconWindow == null)
         {
             draggedIconWindow = new DraggedIconWindow();
         }
         draggedIconWindow.DataContext = icon;
         itemsControl.CaptureMouse();
         itemsControl.MouseUp   += itemsControl_MouseUp;
         itemsControl.MouseMove += itemsControl_MouseMove;
     }
 }