代码如下:
订阅需要拖拽的地方的MouseLeftButtonDown事件,判断当前鼠标状态再执行拖拽
private void UiWindow_MouseLeftButtonDown(object sender,MouseButtonEventArgs e)
{
if (Mouse.LeftButton == MouseButtonState.Pressed)
this.DragMove();
}
WPF System.InvalidOperationException:“只能在按下主鼠标按钮时调用 DragMove。”