如何在windowsphone 8中处理ManipulationCompleted事件

本文关键字:处理 ManipulationCompleted 事件 windowsphone | 更新日期: 2023-09-27 18:00:11

我有以下代码,但它不起作用,有人能建议我需要做什么更改才能使它起作用吗。

Mainscroll.ManipulationCompleted += new EventHandler<System.Windows.Input.ManipulationCompletedEventArgs>(Mainscroll_completed);
 private void Mainscroll_completed(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
        {
            UIElement target = sender as UIElement;
            target.AddHandler(UIElement.ManipulationCompletedEvent, new EventHandler(layoutroot), true);
           // throw new NotImplementedException();
        }
        private void layoutroot(object sender, EventArgs e)
        {
            MessageBox.Show("done");
        }

如何在windowsphone 8中处理ManipulationCompleted事件

替换此行:

Mainscroll.ManipulationCompleted += 
    new EventHandler<System.Windows.Input.ManipulationCompletedEventArgs>(Mainscroll_completed);

这行:

this.Mainscroll.AddHandler(
    Pivot.ManipulationCompletedEvent, 
    new EventHandler<ManipulationCompletedEventArgs>(Mainscroll_completed), true);

并删除:

target.AddHandler(UIElement.ManipulationCompletedEvent......