2

我有以下代码,但它不起作用任何人都可以建议我需要做哪些更改才能使其正常工作。

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

1 回答 1

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......
于 2014-12-02T13:27:35.680 回答