コード例 #1
0
        /*void SetIsEnabledDraggableDescendants(bool isEnabled)
         * {
         *  if (TypeControlUnderMouseAvoidingMove != null)
         *  {
         *      var draggableElements = WPFUtil.FindChilds(TypeControlUnderMouseAvoidingMove, AssociatedObject);
         *      foreach (var de in draggableElements)
         *          DraggableFrameworkElementBehavior.SetIsEnabled(isEnabled, (FrameworkElement)de);
         *  }
         * }*/

        private void AssociatedObject_MouseUp(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left && IsDragging)
            {
#if alldbg || dbg
                DesktopPanelTool.Lib.Debug.WriteLine($"end drag move");
#endif
                IsDragging = false;
                Mouse.Capture(null);
                AssociatedObject.Cursor = CursorDefault;
                ResizableTransparentWindowBehavior.EnableResizableBehavior(AssociatedObject);
                DraggableFrameworkElementBehavior.SetIsEnabledDraggableDescendants(
                    AssociatedObject, TypeControlUnderMouseAvoidingMove, true);
            }
        }
コード例 #2
0
        void SetUpIsMoving(Point setUpIsMovingFrom)
        {
            LastDragMoveTime        = DateTime.Now;
            AssociatedObject.Cursor = CursorDragging;
#if alldbg || dbg
            DesktopPanelTool.Lib.Debug.WriteLine($"start drag move: x={setUpIsMovingFrom.X},y={setUpIsMovingFrom.Y}");
#endif
            InitialPX = setUpIsMovingFrom.X;
            InitialPY = setUpIsMovingFrom.Y;
            Mouse.Capture(AssociatedObject);
            ResizableTransparentWindowBehavior.DisableResizableBehavior(AssociatedObject);
            DraggableFrameworkElementBehavior.SetIsEnabledDraggableDescendants(
                AssociatedObject, TypeControlUnderMouseAvoidingMove, false);
            IsDragging = true;
        }