如何处理Windows Phone 8中的Manipulation Completed事件?

时间:2013-02-20 11:15:28

标签: c# windows-phone-8

我有以下代码,但它没有用,任何人都可以建议我需要做些什么改变才能使其正常工作。

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");
        }

1 个答案:

答案 0 :(得分:0)

替换此行:

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......