public void ClearDragSources() { foreach (var item in DragSources) { UnregisterDragCaptureZoneEvents(item); } DragSources.Clear(); }
public void RemoveDragSource(IDragSource dragSource) { if (!DragSources.Contains(dragSource)) { throw new Exception("Элемент не найден"); } DragSources.Remove(dragSource); UnregisterDragCaptureZoneEvents(dragSource); }
public void RegisterDragSource(IDragSource dragSource) { if (DragSources.Contains(dragSource)) { throw new Exception("Элемент уже был зарегистрирован ранее"); } DragSources.Add(dragSource); RegisterDragCaptureZoneEvents(dragSource); }
private bool InitDrag(Control c, DragSources dragSource) { if (!base.BeginDrag(c)) { return(false); } m_dragSource = dragSource; DropTarget.Clear(); return(true); }
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; }