locked
Silverlight canvas co-ordinates not starting at (0,0) RRS feed

  • Question

  • Hi

    I have a silverlight 4 application which includes a canvas element on top of a grid. When I click on the top-left most point of the canvas and retrieve the co-ordinates, they don't seem to start at (0,0). It even gives me negative values sometimes. This happens when I use IE  8 as my web browser although it seems to be working fine on Google chrome. Also, I have tried the same thing on a few other people's PC's with IE as their default browser and it works just right.

    Because my objective is to draw rectangles on the canvas element, I always get the rectangle being offset by a few pixels to the right or left relative to where I click on the canvas.

    I am not sure if this is an issue with Silverlight and IE or something else to do with my functionality.

    I would be happy to receive some inputs on the same if people out there have some ideas regarding this or have dealt with similar kind of issues before.

    Thanks!

    Thursday, June 9, 2011 9:54 PM

Answers

  • Hi

    The issue got fixed when I changed the child window (on which the canvas element was created) to a grid on the main page.

    Looks like the problem occurs with controls on the child window though not sure how to fix the same on the child window itself.

    Thanks

     

     

    Wednesday, July 6, 2011 6:36 PM

All replies

  • Different behaviors I guess.  Have you gotten the solution?

    Thursday, June 16, 2011 9:43 PM
  • Hi

    The issue got fixed when I changed the child window (on which the canvas element was created) to a grid on the main page.

    Looks like the problem occurs with controls on the child window though not sure how to fix the same on the child window itself.

    Thanks

     

     

    Wednesday, July 6, 2011 6:36 PM