2013-05-27 67 views
1

我刚开始使用Windows Phone 8开发。 而在normalt winforms我可以做一个OnMouseDown和OnMouseUp。Button Down&Up事件

这将如何转化为WP8的发展?如果按下按钮,我需要触发某些东西,而当它被释放时,还需要其他东西吗?

回答

3

请根据您的要求尝试操作开始和操作完成的事件。

 public MainPage() 
     { 
      InitializeComponent(); 
      button.ManipulationStarted += button_ManipulationStarted; 
      button.ManipulationCompleted += button_ManipulationCompleted;   
     } 

     void button_ManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e) 
     { 
      textblock.Text += "\n mouse button up"; 
     } 

     void button_ManipulationStarted(object sender, System.Windows.Input.ManipulationStartedEventArgs e) 
     { 
      textblock.Text += "\n mouse button down"; 
     } 
+0

试过活动和工作。谢谢! – Jieqin

0

我只是用的MouseLeftButtonDown和的MouseLeftButtonUp