Question

So I made my own carousel control in WPF. I have stumbled upon a bug and was wondering if anyone knew how I could fix this like a method call or a series of methods calls or some work-around. Here is a print screen of my carousel:

Carousel Image http://img4.imageshack.us/img4/9599/carousele.jpg

As you can CLEARLY see with this image, my mouse pointer is OVER the button with 16 written on it. But the button with 18 written on it is the one that is blue as if my mouse were over that button. I also set the tooltip to be bound to the content and the tooltip says my mouse is over the button with 18 one it. This should be the CORRECT behavior as 18 is the buttons z-index value. Thus the button with 18 on it should be ON TOP of the button with 16 on it. However, WPF did not render the canvas in such a fashion and I was wondering how to overcome this. I tried canvas.InvalidateArranage(), canvas.invalidateVisual(), canvas.UpdateLayout() but I had no luck. The left side of the canvas shows what it should look like, but the right side fails to produce the same result even though the z-index values are correct, and even this screenshot proves my point that this is a bug in WPF.

Was it helpful?

Solution

In wpf, technically your mouse IS over 18. The way the events (may) be triggered is as follows:

I'm over "16", call the mouseover for 16 I'm over "18", call the mouseover for 18

Since 18 was the most recently called, it's selected (again, just my guess).

In the event args for the mousemove event (I assume mousemove), make sure to set e.Handled = true, this way it's only processed once

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top