2

I am creating a bubbles game, that there is a lot of bubbles on the screen moving and i want to pop a bubble when i click on it with mouse.

I can get the position of Mouse easily but i don't know how to get the position of the ellipse in order to check the intersection with the point of the mouse.

Any ideas about how to get the position of ellipses ?!!

I am using Canvas as my container.

Simon Sarris
  • 62,212
  • 13
  • 141
  • 171
Michael Girgis
  • 145
  • 4
  • 14

2 Answers2

5
Canvas.GetTop(myEllipse);
Canvas.GetLeft(myEllipse);

How to set ellipse position on Canvas using mouse position

Community
  • 1
  • 1
Rover
  • 2,203
  • 3
  • 24
  • 44
3

Why don't you handle PreviewMouseDown (and or PreviewMouseUp) on the Ellipse itself rather than trying to find the clicked ellipse based on position?

Andrew Jones
  • 1,001
  • 1
  • 13
  • 25