WPF trigger for IsMouseOver for DragDrop operation

I am performing a drag & drop operation and want to call an image element to change its source when the ismouseover property is true. Now I understand that the ismouseover property is not updatet when the drag & drop operation works.

Is there any other way to change the image source on mouseover when the drag & drop function is active?

+6
source share
1 answer

I had the same problem and created a new logical element in my IsDragMouseOver custom control and reference this in my control template.

In the control code of the control, I added the following:

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; } 

Hope this helps.

+3
source

All Articles