use*_*830 7 wpf triggers drag-and-drop mouseover
我执行拖放操作,并希望在ismouseover属性为true时触发图像元素更改其源.现在我意识到拖放操作工作时ismouseover属性不是更新.
在拖放处于活动状态时,还有其他方法可以在鼠标悬停时更改图像源吗?
小智 5
我有同样的问题,最后在我的自定义控件中创建一个名为IsDragMouseOver的新布尔值,并在我的控件模板中引用它.
在控件后面的代码中我添加了以下内容:
protected override void OnDragEnter(DragEventArgs e)
{
base.OnDragEnter(e);
IsDragMouseOver = true;
}
protected override void OnDragLeave(DragEventArgs e)
{
base.OnDragLeave(e);
IsDragMouseOver = false;
}
protected override void OnDragOver(DragEventArgs e)
{
base.OnDragOver(e);
IsDragMouseOver = true;
}
protected override void OnDrop(DragEventArgs e)
{
base.OnDrop(e);
IsDragMouseOver = false;
}
Run Code Online (Sandbox Code Playgroud)
希望有所帮助.
归档时间: |
|
查看次数: |
1366 次 |
最近记录: |