拖动; Drop Button无法点击,闪烁的Cursor

时间:2014-07-23 07:18:00

标签: c# wpf

我已经在我的UI中的某些按钮上实现了拖放功能。 所有按钮都启用了“AllowDrop = true”(因此任何按钮都是源/目标)。

现在所有按钮都不可点击,当鼠标悬停在按钮上时,光标在正常光标和拖动光标之间闪烁。我实现了AllowDrop = false然后是true,它闪烁得更少但仍然闪烁。

以下代码

        if (e.LeftButton == MouseButtonState.Pressed &&
            Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance ||
            Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance)
        {
            button.AllowDrop = false;
            DragDrop.DoDragDrop(button, button.Background.ToString(), DragDropEffects.Copy);
            button.AllowDrop = true;
        }

1 个答案:

答案 0 :(得分:0)

似乎我没有在if语句周围使用括号:if(e.LeftButton == MouseButtonState.Pressed&&(Math.Abs​​(diff.X)> SystemParameters.MinimumHorizo​​ntalDragDistance ||                 Math.Abs​​(diff.Y)> SystemParameters.MinimumVerticalDragDistance))