示例#1
0
        public bool CanDrop(IDragableSource source, DropContext context)
        {
            if (source == null)
            {
                return(false);
            }


            return(source.Items.All(droppedItem => CanDropItem(droppedItem, context)));
        }
示例#2
0
        public bool CanDrop(IDragableSource source, DropContext context)
        {
            if (source == null)
            {
                return(false);
            }

            if (!(context.Data is System.Collections.IList))
            {
                return(false);
            }

            return(source.Items.All(item => CanDropItem(item, context)));
        }
示例#3
0
        public DropResult Drop(IDragableSource source, DropContext context)
        {
            if (!CanDrop(source, context))
            {
                return(new DropResult());
            }


            var finalItems = new List <object>();

            foreach (var droppedItem in source.Items)
            {
                finalItems.Add(DropItem(droppedItem, context));
            }

            return(new DropResult(finalItems));
        }
示例#4
0
        public DropResult Drop(IDragableSource source, DropContext context)
        {
            if (!CanDrop(source, context))
            {
                return(new DropResult());
            }

            var resultItems = new List <object>();

            foreach (object item in source.Items)
            {
                var finalItem = DropItem(item, context);
                if (finalItem != null)
                {
                    resultItems.Add(finalItem);
                }
            }

            return(new DropResult(resultItems));
        }
示例#5
0
 void AssociatedObject_MouseLeave(object sender, MouseEventArgs e)
 {
     try
     {
         if (isMouseClicked)
         {
             //set the item's DataContext as the data to be transferred
             IDragableSource dragObject = this.AssociatedObject.DataContext as IDragableSource;
             if (dragObject != null)
             {
                 DataObject data = new DataObject();
                 data.SetData(typeof(IDragableSource), dragObject);
                 System.Windows.DragDrop.DoDragDrop(this.AssociatedObject, data, DragDropEffects.Move);
             }
         }
         isMouseClicked = false;
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex.ToString());
     }
 }
示例#6
0
 DropResult IDropable.Drop(IDragableSource source, DropContext context)
 {
     return(Games.Drop(source, context));
 }
示例#7
0
 bool IDropable.CanDrop(IDragableSource source, DropContext context)
 {
     return(Games.CanDrop(source, context));
 }
示例#8
0
 bool IDropable.CanDrop(IDragableSource source, DropContext context)
 {
     return(this.Items.CanDrop(source, context));
 }