Movement of a user control that is on an image


  • I have a Windows 8 app and a user control. The user control moves along my finger in the right left and bottom movements. When I try to move up , the body of User control is there and unless I move out of it , its not moving up.

    as u can see in the image that my pointer is on the user control and I am trying to move up but its not happenning. The condition is like , I can click anywhere , the user control appears I can move it anywhere and even if my finger is on the user control , it should keep moving


    Apoorv Kumar Upadhyay

    Monday, March 09, 2015 1:49 PM

All replies

  • Hi Apoorv,

    How did you place your Usercontrol on that image? How did you implement the moveable UserControl? Could you provide some code snippets?

    In my experience, we can place a Usercontrol and Image control into Canvas control, to make a moveable Usercontrol, we can handle ManipulationDelta event and use Transform, here is my sample:


            <Rectangle Width="100" Height="100" Fill="Red"
                       ManipulationDelta="Rectangle_ManipulationDelta" />

    private void Rectangle_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
                var _Rectangle = sender as Windows.UI.Xaml.Shapes.Rectangle;
                var _Transform = (_Rectangle.RenderTransform as CompositeTransform)
                    ?? (_Rectangle.RenderTransform = new CompositeTransform()) as CompositeTransform;
                _Transform.TranslateX += e.Delta.Translation.X;
                _Transform.TranslateY += e.Delta.Translation.Y;


    <Canvas Name="cv">
                <Image Width="{Binding ActualWidth,ElementName=cv}" Source="Assets/1.jpg" Stretch="Fill" />
                <local:MyUserControl1 />

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, March 10, 2015 3:04 AM
  • Hi ,

         I am not using rectangle for Cropping . Actually I need to implement clipping in my code ! Cropping seems to be very slow for me

    Apoorv Kumar Upadhyay

    Monday, March 23, 2015 6:28 AM