コード例 #1
0
        private static void OnIsDragDropEnabledChanged(DependencyObject target, DependencyPropertyChangedEventArgs args)
        {
            RadToolBarTray tray = (RadToolBarTray)target;

            if ((bool)args.OldValue)
            {
                DragDropManager.RemoveDragInitializeHandler(tray, TrayDragInitialized);
                DragDropManager.RemoveDragEnterHandler(tray, TrayDragEntered);
                DragDropManager.RemoveDragOverHandler(tray, TrayDraggedOver);
                DragDropManager.RemoveDragLeaveHandler(tray, TrayDragLeft);
                DragDropManager.RemoveDropHandler(tray, TrayDropped);
            }

            if ((bool)args.NewValue)
            {
                DragDropManager.AddDragInitializeHandler(tray, TrayDragInitialized);
                DragDropManager.AddDragEnterHandler(tray, TrayDragEntered);
                DragDropManager.AddDragOverHandler(tray, TrayDraggedOver);
                DragDropManager.AddDragLeaveHandler(tray, TrayDragLeft);
                DragDropManager.AddDropHandler(tray, TrayDropped);
            }
        }