Question

I'm developing an application for WP7.

In this application there are some pictures. When an user clicks on an image, the coords of the other images change. To do this, I use this code on any image:

 picture.Margin = new Thickness(268, 90, 120, 225);

The problem is that when I change the coords, the area where an image was before is still clickable, even if it's empty and the image is on a different place! (the event works on the image and also where the image was before, but I want It to only work on the new position)

How can I do this?

Était-ce utile?

La solution

Try InvalidateArange() and InvalidateMeasure() for the first.

I'm afraid that clickable area not only in old and new position - it's problem with incorrect margins, so check it one more time, please.

Also, how you handle click event on your picture (with GestureSercive, you placed it inside Button or just OnMouseLeftButtonUp?)

And the last - layout with such margins 268, 90, 120, 225 it's not a good practice. Try to understand how your elements relate to each other and design your layout better.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top