private void UpdateHelpers(object sender, DragEventArgs e) { DependencyObject HitObject = e.OriginalSource as DependencyObject; //this.HandleAutoScroll(sender, e); if (this.hitObject != HitObject) { this.hitObject = HitObject; //Dispose old helper this.DisposeHelpers(); //Get new list of helper while (HitObject != null && HitObject != this.element) { if (HitObject is UIElement) { this.uiHelper.AddRange((from Helper in DragDrop.GetDragDropUiHelper(HitObject.GetType()) select Helper.Create((UIElement)HitObject)).ToArray()); } HitObject = VisualTreeHelper.GetParent(HitObject); } } }
/// <summary> /// Gets the handler for the given UI element type used as drag and drop target /// </summary> /// <remarks> /// <para> /// The handlers are searched to find the most specific handler available for the type. This means, /// first the handler for the exact type is searched for. If nothing is found, the search is repeated /// with the base type and so on. /// </para> /// <para> /// if nothing is foud, <c>null</c> is returned /// </para> /// </remarks> public static IDragDropUiTargetHandler GetDragDropUITargetHandler(Type uiElementType) { return(DragDrop.GetDragDropUIHandler(DragDrop.dragTargetHandlers, uiElementType)); }
/// <summary> /// Gets the handler for the given UI element type used as drag and drop target /// </summary> /// <remarks> /// <para> /// The handlers are searched to find the most specific handler available for the type. This means, /// first the handler for the exact type is searched for. If nothing is found, the search is repeated /// with the base type and so on. /// </para> /// <para> /// if nothing is foud, <c>null</c> is returned /// </para> /// </remarks> public static IDragDropUiSourceHandler GetDragDropUISourceHandler(Type uiElementType) { return(DragDrop.GetDragDropUIHandler(DragDrop.dragSourceHandlers, uiElementType)); }