C# 如何在windows phone上将图像自动移动到特定的X、Y位置?

C# 如何在windows phone上将图像自动移动到特定的X、Y位置?,c#,windows-phone-8,C#,Windows Phone 8,如何将图像自动移动到屏幕上触摸的特定X、Y位置 <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28"> <TextBlock x:Name="txttouch" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/> <TextBlock

如何将图像自动移动到屏幕上触摸的特定X、Y位置

     <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
        <TextBlock x:Name="txttouch" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
        <TextBlock x:Name="txtpoint" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <Grid x:Name="grid1" Grid.Row="1" Margin="12,0,12,0">
        <Image x:Name="imagenew"  Source="1.png" Height="30" Width="30">
            <Image.RenderTransform>
                <TranslateTransform x:Name="transimage"/>
            </Image.RenderTransform>
        </Image>


    </Grid>

  </Grid>
我尝试过使用ManufactionStarted,但这不起作用

     <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
        <TextBlock x:Name="txttouch" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
        <TextBlock x:Name="txtpoint" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <Grid x:Name="grid1" Grid.Row="1" Margin="12,0,12,0">
        <Image x:Name="imagenew"  Source="1.png" Height="30" Width="30">
            <Image.RenderTransform>
                <TranslateTransform x:Name="transimage"/>
            </Image.RenderTransform>
        </Image>


    </Grid>

  </Grid>
这是我的代码:

     <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
        <TextBlock x:Name="txttouch" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
        <TextBlock x:Name="txtpoint" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <Grid x:Name="grid1" Grid.Row="1" Margin="12,0,12,0">
        <Image x:Name="imagenew"  Source="1.png" Height="30" Width="30">
            <Image.RenderTransform>
                <TranslateTransform x:Name="transimage"/>
            </Image.RenderTransform>
        </Image>


    </Grid>

  </Grid>
XML:

     <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
        <TextBlock x:Name="txttouch" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
        <TextBlock x:Name="txtpoint" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <Grid x:Name="grid1" Grid.Row="1" Margin="12,0,12,0">
        <Image x:Name="imagenew"  Source="1.png" Height="30" Width="30">
            <Image.RenderTransform>
                <TranslateTransform x:Name="transimage"/>
            </Image.RenderTransform>
        </Image>


    </Grid>

  </Grid>

     <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
        <TextBlock x:Name="txttouch" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
        <TextBlock x:Name="txtpoint" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <Grid x:Name="grid1" Grid.Row="1" Margin="12,0,12,0">
        <Image x:Name="imagenew"  Source="1.png" Height="30" Width="30">
            <Image.RenderTransform>
                <TranslateTransform x:Name="transimage"/>
            </Image.RenderTransform>
        </Image>


    </Grid>

  </Grid>

ManipulationOrigin
显然是操作的固定起点。您应该使用类似于
操作delta

Canvas的方法,它为您提供了明确设置子位置的机会

     <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
        <TextBlock x:Name="txttouch" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
        <TextBlock x:Name="txtpoint" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <Grid x:Name="grid1" Grid.Row="1" Margin="12,0,12,0">
        <Image x:Name="imagenew"  Source="1.png" Height="30" Width="30">
            <Image.RenderTransform>
                <TranslateTransform x:Name="transimage"/>
            </Image.RenderTransform>
        </Image>


    </Grid>

  </Grid>
<Grid x:Name="grid1" Grid.Row="1" Margin="12,0,12,0">
  <Canvas>
    <Image x:Name="imagenew"  Source="1.png" Height="30" Width="30">
        <Image.RenderTransform>
            <TranslateTransform x:Name="transimage"/>
        </Image.RenderTransform>
    </Image>                             
   </Canvas>
</Grid>