Windows Phone 8.1 Manipulation 操纵

network | | 访问(69)
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,40,0,28">
        <TextBlock x:Name="ApplicationTitle" Text="Manipulation事件测试" FontSize="20"/>
        <TextBlock x:Name="PageTitle" Text="触摸这里" FontSize="60"
                       ManipulationMode="All"
                       ManipulationStarting="PageTitle_ManipulationStarting"
                       ManipulationStarted="PageTitle_ManipulationStarted" 
                       ManipulationDelta="PageTitle_ManipulationDelta"
                       ManipulationInertiaStarting="PageTitle_ManipulationInertiaStarting"
                       ManipulationCompleted="PageTitle_ManipulationCompleted"/>
    </StackPanel>
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <ListView Name="list"></ListView>
    </Grid>
</Grid>
public sealed partial class MainPage: Page {
    public MainPage() {
        this.InitializeComponent();

    }

    void PageTitle_ManipulationStarting(object sender, ManipulationStartingRoutedEventArgs e) {
        list.Items.Add("ManipulationStarting触发表示Manipulation系列事件开始");
        list.Items.Add("----------------------------");
    }
    private void PageTitle_ManipulationStarted(object sender, ManipulationStartedRoutedEventArgs e) {
        list.Items.Add("ManipulationStarted你的手指刚接触到PageTitle控件");
        list.Items.Add("接触点  X:" + e.Position.X + "  Y:" + e.Position.Y);
        list.Items.Add("----------------------------");
    }

    private void PageTitle_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e) {
        list.Items.Add("ManipulationDelta 手指在滑动的过程中");
        list.Items.Add("变化 Translation X:" + e.Delta.Translation.X + "  Y:" + e.Delta.Translation.Y);
        list.Items.Add("累增 Translation X:" + e.Cumulative.Translation.X + "  Y:" + e.Cumulative.Translation.Y);
        list.Items.Add("线速度 Linear X:" + e.Velocities.Linear.X + "  Y:" + e.Velocities.Linear.Y + " IsInertial:" + e.IsInertial);
        list.Items.Add("----------------------------");
    }

    void PageTitle_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) {
        list.Items.Add("ManipulationInertiaStarting 发生延迟");
        list.Items.Add("变化 Translation X:" + e.Delta.Translation.X + "  Y:" + e.Delta.Translation.Y);
        list.Items.Add("累增 Translation X:" + e.Cumulative.Translation.X + "  Y:" + e.Cumulative.Translation.Y);
        list.Items.Add("线速度 Linear X:" + e.Velocities.Linear.X + "  Y:" + e.Velocities.Linear.Y);
        list.Items.Add("----------------------------");
    }

    private void PageTitle_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e) {
        list.Items.Add("ManipulationCompleted手指离开了屏幕");
        list.Items.Add("总的变化 Translation X:" + e.Cumulative.Translation.X + " Y:" + e.Cumulative.Translation.Y);
        list.Items.Add("最后的线速度  X:" + e.Velocities.Linear.X + "  Y:" + e.Velocities.Linear.Y + " IsInertial: " + e.IsInertial);
        list.Items.Add("----------------------------");
    }

    protected override void OnNavigatedTo(NavigationEventArgs e) {}
}