7
votes

I do a drag&drop operation and want to trigger a image element to change its source when the ismouseover property is true. Now i realize that the ismouseover property is not updatet when the drag&drop operation works.

Is there a other way to change the image source on mouseover while drag&drop is active?

1

1 Answers

5
votes

I had the same issue and ended up creating a new boolean in my Custom control called IsDragMouseOver and referencing that in my control template.

In the code behind 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 that helps.