示例#1
0
 public void ClearDragSources()
 {
     foreach (var item in DragSources)
     {
         UnregisterDragCaptureZoneEvents(item);
     }
     DragSources.Clear();
 }
示例#2
0
 public void RemoveDragSource(IDragSource dragSource)
 {
     if (!DragSources.Contains(dragSource))
     {
         throw new Exception("Элемент не найден");
     }
     DragSources.Remove(dragSource);
     UnregisterDragCaptureZoneEvents(dragSource);
 }
示例#3
0
 public void RegisterDragSource(IDragSource dragSource)
 {
     if (DragSources.Contains(dragSource))
     {
         throw new Exception("Элемент уже был зарегистрирован ранее");
     }
     DragSources.Add(dragSource);
     RegisterDragCaptureZoneEvents(dragSource);
 }
示例#4
0
        private bool InitDrag(Control c, DragSources dragSource)
        {
            if (!base.BeginDrag(c))
            {
                return(false);
            }

            m_dragSource = dragSource;
            DropTarget.Clear();
            return(true);
        }
示例#5
0
        private IDragSource FindParentSelectedDragSource(IDragSource dragSource)
        {
            DependencyObject parent = dragSource.Instanse.Parent;

            while (parent != null)
            {
                var parentDragSource = parent as IDragSource;
                if ((parentDragSource != null) && parentDragSource.IsSelected &&
                    DragSources.Contains(parentDragSource))
                {
                    return(parentDragSource);
                }
                parent = VisualTreeHelper.GetParent(parent);
            }
            return(null);
        }
 /// <summary>
 /// Trigerred when the seconds hand is started for being dragged
 /// </summary>
 /// <param name="args">The drag event arguments</param>
 protected void SecondsHand_DragStart(DragEventArgs args)
 {
     //Set the current drag source to seconds hand so that Clock_DragOver operates on it
     DragSource = DragSources.SecondsHand;
 }