Windows Phone 8.1 PointerMoved 点击移动区域

network | | 访问(53)
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
          PointerMoved="Grid_PointerMoved">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,35,0,28">
        <TextBlock Text="请点击移动截取区域" FontSize="20"  />
        <TextBlock Text="点击移动区域" FontSize="60" />
    </StackPanel>

    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0" >
        <Grid.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="Black" Offset="0.014"/>
                <GradientStop Color="#FFBD2727" Offset="0.844"/>
            </LinearGradientBrush>
        </Grid.Background>
        <Grid.Clip>
            <RectangleGeometry x:Name="geometry" Rect="0,0,150,150" ></RectangleGeometry>
        </Grid.Clip>
        <StackPanel>
            <Button Content="测试"></Button>
        </StackPanel>
    </Grid>
</Grid>
private void Grid_PointerMoved(object sender, PointerRoutedEventArgs e) {
    Point p = e.GetCurrentPoint(ContentPanel).Position;
    geometry.Rect = new Rect(p.X, p.Y, 150, 150);
}