Loading

WPF System.InvalidOperationException:“只能在按下主鼠标按钮时调用 DragMove。”

代码如下:
订阅需要拖拽的地方的MouseLeftButtonDown事件,判断当前鼠标状态再执行拖拽

        private void UiWindow_MouseLeftButtonDown(object sender,MouseButtonEventArgs e)
        {
            if (Mouse.LeftButton == MouseButtonState.Pressed)
                this.DragMove();
        }
posted @ 2021-04-08 15:33  Stay627  阅读(879)  评论(0编辑  收藏  举报