コード例 #1
0
        //private void Drag(DragCommandParameter parameter)
        //{
        //  if (Picture != null)
        //  {
        //    IDataObject dataObject = DragDropBehavior.CreateDataObject(Picture);
        //    DragDropEffects effect = DragDrop.DoDragDrop(parameter.DragSource, dataObject, DragDropEffects.Move);
        //    if ((effect & DragDropEffects.Move) != 0)
        //      Picture = null;
        //  }
        //}


        private bool CanDrop(DropCommandParameter parameter)
        {
            // Extract data.
            var draggedPicture = DragDropBehavior.GetData(parameter.DragEventArgs.Data) as PictureViewModel;

            // To enable Drop the preview area needs to be empty and the dragged data needs to be a
            // picture.
            if (Picture == null && draggedPicture != null)
            {
                parameter.Data = draggedPicture;
                parameter.DragEventArgs.Effects = DragDropEffects.Move;
                return(true);
            }

            return(false);
        }
コード例 #2
0
 private void Drop(DropCommandParameter parameter)
 {
     Picture = (PictureViewModel)parameter.Data;
 }