不知道为什么会这样。我在拖放时订阅了 GiveFeedback。
在此 GiveFeedback 中,我正在检查鼠标左键的状态。如果它发布了,我想做“某事”(不重要)。
下面总是返回“鼠标按钮释放”。
我的代码:
private void GiveDragFeedback(object sender, GiveFeedbackEventArgs args)
{
var mouseArgs = new MouseEventArgs(Mouse.PrimaryDevice, 0);
if (Mouse.LeftButton == MouseButtonState.Pressed)
Console.WriteLine("Mouse Button PRESSED");
else
Console.WriteLine("Mouse Button RELEASED");
if (Mouse.PrimaryDevice.LeftButton == MouseButtonState.Pressed)
_adorner_MouseMove(sender, new MouseEventArgs(Mouse.PrimaryDevice, 0));
else
_adorner_MouseUp(sender, mouseArgs);
}