internal static void RemoveDragLeaveHandler(DependencyObject element, CustomDragEventHandler handler)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     if (handler == null)
     {
         throw new ArgumentNullException("handler");
     }
     CustomExtendedRoutedEventHandlerCollection<CustomDragEventHandler, CustomDragEventArgs> dragLeaveHandlers = element.GetDragLeaveHandlers();
     if (dragLeaveHandlers != null)
     {
         dragLeaveHandlers.Remove(handler);
     }
 }
 internal static void AddDragLeaveHandler(DependencyObject element, CustomDragEventHandler handler, bool handledEventsToo)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     if (handler == null)
     {
         throw new ArgumentNullException("handler");
     }
     CustomExtendedRoutedEventHandlerCollection<CustomDragEventHandler, CustomDragEventArgs> dragLeaveHandlers = element.GetDragLeaveHandlers();
     CustomExtendedRoutedEventHandlerCollection<CustomDragEventHandler, CustomDragEventArgs> handlers2 = dragLeaveHandlers ?? new CustomExtendedRoutedEventHandlerCollection<CustomDragEventHandler, CustomDragEventArgs>((h, a) => h(element, a));
     handlers2.Add(handler, handledEventsToo);
     if (handlers2 != dragLeaveHandlers)
     {
         element.SetValue(DragLeaveHandlerProperty, handlers2);
     }
 }
        /// <summary>
        /// Adds a handler to the attached DragLeave event.
        /// </summary>
        /// <param name="element">The DependencyObject to attach an event handler for.</param>
        /// <param name="handler">The event handler.</param>
        /// <param name="handledEventsToo">A value Indicating whether to invoke the handler if the event is handled.</param>
        internal static void AddDragLeaveHandler(DependencyObject element, DragEventHandler handler, bool handledEventsToo)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }

            ExtendedRoutedEventHandlerCollection<DragEventHandler, DragEventArgs> originalHandlers = element.GetDragLeaveHandlers();
            ExtendedRoutedEventHandlerCollection<DragEventHandler, DragEventArgs> handlers = originalHandlers ?? new ExtendedRoutedEventHandlerCollection<DragEventHandler, DragEventArgs>((h, a) => h(element, a)); 
            handlers.Add(handler, handledEventsToo);
            if (handlers != originalHandlers)
            {
                element.SetValue(DragLeaveHandlerProperty, handlers);
            }
        }