示例#1
0
        private static void IsDragSourceChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            var dragSource = obj as ItemsControl;

            if (dragSource != null)
            {
                if (Equals(e.NewValue, true))
                {
                    DragHelpers[dragSource] = new ItemsControlDrag(dragSource);
                }
                else
                {
                    ItemsControlDrag drag;
                    if (DragHelpers.TryGetValue(dragSource, out drag))
                    {
                        drag.Dispose();
                        DragHelpers.Remove(dragSource);
                    }
                }
            }
        }
示例#2
0
 private static void IsDragSourceChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
 {
     var dragSource = obj as ItemsControl;
     if (dragSource != null)
     {
         if (Equals(e.NewValue, true))
         {
             DragHelpers[dragSource] = new ItemsControlDrag(dragSource);
         }
         else
         {
             ItemsControlDrag drag;
             if (DragHelpers.TryGetValue(dragSource, out drag))
             {
                 drag.Dispose();
                 DragHelpers.Remove(dragSource);
             }
         }
     }
 }