【问题标题】:MouseLeftButtonUp does not fire all the time in WP7MouseLeftButtonUp 在 WP7 中不会一直触发
【发布时间】:2012-09-11 14:12:36
【问题描述】:

在我的应用程序中有一个带有小图像的画布(不占用画布的整个空间)。 当用户单击图像并在画布内拖动时,它会用黑线跟踪路径。直到这里一切正常。现在,我希望用户释放鼠标后立即删除路径。我在canvas 上使用MouseLeftButtonUp 来检测鼠标释放。现在的问题是这是随机工作的。有时它会触发,有时则不会。请帮忙。

XAML:

 <Canvas Height="400" HorizontalAlignment="Center"  Margin="10,10,0,0" Name="canvas1" VerticalAlignment="Center" Background="Aqua"  Width="400">
 <Image Canvas.ZIndex="30" Canvas.Left="10" Canvas.Top="10" Height="20" Name="dot1" Stretch="Uniform" Width="20" Source="/BoxIt;component/Images/dot.png" MouseLeftButtonDown="dot_MouseLeftButtonDown" />
 </Canvas>

C#:

 this.canvas1.MouseMove += new MouseEventHandler(canvas1_MouseMove);
 this.canvas1.MouseLeftButtonUp += new MouseButtonEventHandler(canvas1_MouseLeftButtonUp);

C# 中的事件处理程序:

 void canvas1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
    {
       // code to delete the path
    }

【问题讨论】:

    标签: c# windows-phone-7 mouseleftbuttonup


    【解决方案1】:

    在 Windows Phone 中,我们建议使用 TapHold 和 Manipulation* 方法,而不是鼠标相关的事件。

    请阅读this了解更多信息。

    【讨论】:

      猜你喜欢
      • 2012-09-11
      • 1970-01-01
      • 2010-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多