Click here to Skip to main content
15,942,710 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am really need help with return the coordinates x and y in the WP7 screen. this code help me to move an rectangle in the screen with showing the start(x&y), delta(x,y) and end(x,y) :

C#
TransformGroup transformG;
        TranslateTransform translation;

        // Constructor
        public MainPage()
        {
            InitializeComponent();
            this.ManipulationDelta += new EventHandler<ManipulationDeltaEventArgs>(MainPage_ManipulationDelta);
            transformG = new TransformGroup();
            translation = new TranslateTransform();
            transformG.Children.Add(translation);
            rectangle.RenderTransform = transformG;
        }

        void MainPage_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            startX.Text =e.ManipulationOrigin.X.ToString();
            startY.Text = e.ManipulationOrigin.Y.ToString();
            DeltaX.Text = e.DeltaManipulation.Translation.X.ToString();
            DeltaY.Text = e.DeltaManipulation.Translation.Y.ToString();
            translation.X += e.DeltaManipulation.Translation.X;
            translation.Y += e.DeltaManipulation.Translation.Y;
            EndX.Text =Convert.ToString(translation.X);
            EndY.Text = Convert.ToString(translation.Y);
        }


I just want to do something like that but without move anything, just tap in the screen and know the start and the end with delta (difference). I use silverlight
Posted

1 solution

Thanks a lot, I find the solution
its work without define rectangle to add it in translation

it can work itself
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900