private static void IsDropTargetChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { var dropTarget = obj as ItemsControl; if (dropTarget != null) { if (Equals(e.NewValue, true)) { DropHelpers[dropTarget] = new ItemsControlDrop(dropTarget); } else { ItemsControlDrop drop; if (DropHelpers.TryGetValue(dropTarget, out drop)) { drop.Dispose(); DropHelpers.Remove(dropTarget); } } } }