Windows phone 7 取消Windows Phone上的事件
我有一个透视控件中的图像列表。如果触摸图像,它将导航到另一个视图。如果轻弹通过一个新的轴,同时触摸图像,它就会导航 我注意到Facebook应用程序或本地相册没有这个bug 有什么想法吗 编辑:代码:Windows phone 7 取消Windows Phone上的事件,windows-phone-7,Windows Phone 7,我有一个透视控件中的图像列表。如果触摸图像,它将导航到另一个视图。如果轻弹通过一个新的轴,同时触摸图像,它就会导航 我注意到Facebook应用程序或本地相册没有这个bug 有什么想法吗 编辑:代码: Image img = new Image(); Delay.LowProfileImageLoader.SetUriSource(img, new Uri(adViewModel.Ph
Image img = new Image();
Delay.LowProfileImageLoader.SetUriSource(img, new Uri(adViewModel.Photos[k].ThbUrl));
img.Width = 150;
img.Tag = k;
img.Height = 150;
img.MouseLeftButtonDown += new MouseButtonEventHandler(launch_Diapo);
Grid.SetRow(img, i);
Grid.SetColumn(img, j);
PhotosGrid.Children.Add(img);
如果你能展示你的代码,我们可能会提供一个更具体的答案 然而: 我猜您正在使用
MouseButtonLeftDown
或类似工具来检测图像的触摸。不要这样做,而是使用来自的轻触
手势。这应该可以防止您遇到的问题
有一种可能的替代方法可以在您触摸图像时禁用透视手势,但这取决于您在透视项中使用图像的方式,最终可能会阻止正确的透视导航
您可以在如下代码中添加点击事件:
var gl = GestureService.GetGestureListener(img);
gl.Tap += new EventHandler<GestureEventArgs>(gl_Tap);
甚至我也有类似的问题。我所做的是,检查MouseButtonLeftDown
position和MouseButtonLeftUp
position。如果它们相等,则导航其他操作。我将在下面粘贴代码
Point temp;
void img_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
temp = e.GetPosition(null);
}
void img_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
Point point = e.GetPosition(null);
if (point == temp)
{
this.NavigationService.Navigate(new Uri(...));
}
}
我添加了我的代码,可能是鼠标按钮的左下角,因为我不使用tap。如何以编程方式使用tap?我只看到了xaml的例子。我需要创建一个手势监听器,但如何将其绑定到我的图像?如果这样做,您可能希望为少量移动添加一些容差。否则,您可能会错过用户认为是轻击,但实际上是非常小的轻击。
Point temp;
void img_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
temp = e.GetPosition(null);
}
void img_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
Point point = e.GetPosition(null);
if (point == temp)
{
this.NavigationService.Navigate(new Uri(...));
}
}