locked
identifying control manipulated RRS feed

  • Question

  • Hi all,

    I have a question regarding identifying the control that has been clicked (or in this case, manipulated) in Silverlight for Windows Phone 7.

    Here's the xaml code:
            <TextBlock Canvas.Left="0" Canvas.Top="0" Height="96" Width="96" Name="x0y0" Text="A" Style="{StaticResource letterstyle}" ManipulationCompleted="ManCompleted" ManipulationStarted="ManStarted" />
            <TextBlock Canvas.Left="96" Canvas.Top="0" Height="96" Width="96" Name="x1y0" Text="B" Style="{StaticResource letterstyle}" ManipulationCompleted="ManCompleted" ManipulationStarted="ManStarted" />
            etc.

    And here's the .cs code:

            private void ManCompleted(object sender, ManipulationCompletedEventArgs e)
            {
                // string sendername = sender.ToString; //how should I find the name of the sender, such as "x1y0"?
                double manX = e.TotalManipulation.Translation.X;
                double manY = e.TotalManipulation.Translation.Y;
                PageTitle.Text = sendername + "  " + manX + "  " + manY;
                etc.

    So how should I find out which textblock has been manipulated?

    Thanks a lot,

    Pettrer

    Tuesday, June 7, 2011 6:19 PM

Answers

  • string s = ((TextBlock) sender).Name;
    Wednesday, June 8, 2011 3:13 AM

All replies