locked
Mouse position in a stackpanel RRS feed

  • Question

  • Hi,

    I have a stackpanel that contains a rectangle. Now I want to get a mouse position of where is was clicked but related to the rectangle (so if I clikc on left top corner of the rectangle I will get 0,0).

    I tried these (mouse MouseLeftButtonDown handler):

    e.getPosition(null)
    e.getPosition(this)
    e.getPosition(sender as Rectangle)

    none of them worked.

    Please help me out.

    cheers

    pete

     

    )

     

    Monday, January 24, 2011 8:40 AM

Answers

  • Point mouse = e.GetPosition(Mystackpanel);

                    double X = mouse.X;
                    double Y = mouse.Y;

    Monday, January 24, 2011 9:32 AM

All replies

  • Point mouse = e.GetPosition(Mystackpanel);

                    double X = mouse.X;
                    double Y = mouse.Y;

    Monday, January 24, 2011 9:32 AM
  • I hope that will help you.

    Monday, January 24, 2011 9:34 AM