Making cursor stick to an element in Store app


  • I have some adorners on each corner of a canvas and when the cursor is over them the cursor changes to northsouth cursor, I want that cursor to stick to the adorner, is there a way to do this?


    Friday, February 13, 2015 6:03 PM

All replies

  • Can you please explain what you mean by sticking? I'm not sure what you are asking.
    Friday, February 13, 2015 6:24 PM
  • Yes sorry, Its a canvas which is used for cropping an image in much the same way as the one in the Windows Photos app, it has an ellipse at each corner. When you drag the ellipse the cropping rectangle changes.

    All this works fine, I have changed the cursor on each corner when entering and moving but when I drag the cursor moves out of the ellipse. I want the cursor to be stationary over the ellipse whilst dragging and only the ellipse and the rectangle move.

    I hope that's a bit clearer


    Friday, February 13, 2015 6:31 PM
  • Hi Mal,

    You're going to have to do that the other way around: instead of trapping the cursor you'll need to make sure the ellipses follow the cursor. You can capture the pointer so that your ellipse still gets the pointer messages if the pointer moves off of the ellipse itself.


    Friday, February 13, 2015 11:51 PM
  • Thanks Rob

    I have tried the following transform, the ellipse does follow the cursor but lags behind more and more as I drag, any ideas?

            private void topLeftCorner_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
                ContentControl leftEllipse = sender as ContentControl;
                TranslateTransform translateTransform = leftEllipse.RenderTransform as TranslateTransform;
                translateTransform.X += e.Delta.Translation.X;
                translateTransform.Y += e.Delta.Translation.Y; 


    Saturday, February 14, 2015 10:06 AM