Windows Phone 中双击的问题
我在我的应用程序中发现了一个奇怪的点击问题。我有 42 个按钮,以日历的形式排列为 6x7。每个按钮都调用相同的函数 OnDoubleTap,这是按钮的事件之一。
问题是,连续点击两个按钮将被视为双击第二个点击的按钮。
public void OnButtonDoubleTap(object sender, System.Windows.Input.GestureEventArgs e)
{
// function
}
这个函数通过像这样的 xaml 代码与所有 42 个按钮相关联
<Button x:Name="b00" Content="" Height="60" Width="68" MinWidth="68" MinHeight="60" Click="OnClick" DoubleTap="OnButtonDoubleTap" Foreground="#FF171717" BorderThickness="0" Hold="OnButtonLongPress" Style="{StaticResource DateButtonTemplate}" FontFamily="{StaticResource CicleFina}" />
<Button x:Name="b01" Content="" Height="60" Canvas.Left="68" Width="68" MinWidth="68" MinHeight="60" Click="OnClick" DoubleTap="OnButtonDoubleTap" Hold="OnButtonLongPress" Foreground="#FF171717" BorderThickness="0" Style="{StaticResource DateButtonTemplate}" FontFamily="{StaticResource CicleFina}"/>
<Button x:Name="b02" Content="" Height="60" Canvas.Left="136" Width="68" MinWidth="68" MinHeight="60" Click="OnClick" DoubleTap="OnButtonDoubleTap" Hold="OnButtonLongPress" Foreground="#FF171717" BorderThickness="0" Style="{StaticResource DateButtonTemplate}" FontFamily="{StaticResource CicleFina}"/>
<Button x:Name="b03" Content="" Height="60" Canvas.Left="204" Width="68" MinWidth="68" MinHeight="60" Click="OnClick" DoubleTap="OnButtonDoubleTap" Hold="OnButtonLongPress" Foreground="#FF171717" BorderThickness="0" Style="{StaticResource DateButtonTemplate}" FontFamily="{StaticResource CicleFina}"/>
<Button x:Name="b04" Content="" Height="60" Canvas.Left="272" Width="68" MinWidth="68" MinHeight="60" Click="OnClick" DoubleTap="OnButtonDoubleTap" Hold="OnButtonLongPress" Foreground="#FF171717" BorderThickness="0" Style="{StaticResource DateButtonTemplate}" FontFamily="{StaticResource CicleFina}"/>
知道为什么会发生这种情况吗?
阿尔法
I have found a strange tap issue in my app. I have 42 buttons arranged 6x7 in the form of a calendar. Every button has calls the same function OnDoubleTap which is the one of the events of a button.
The problem is, successive taps on two buttons is treated as a double tap on the second tapped button.
public void OnButtonDoubleTap(object sender, System.Windows.Input.GestureEventArgs e)
{
// function
}
this function is associated with all the 42 buttons through the xaml code like this
<Button x:Name="b00" Content="" Height="60" Width="68" MinWidth="68" MinHeight="60" Click="OnClick" DoubleTap="OnButtonDoubleTap" Foreground="#FF171717" BorderThickness="0" Hold="OnButtonLongPress" Style="{StaticResource DateButtonTemplate}" FontFamily="{StaticResource CicleFina}" />
<Button x:Name="b01" Content="" Height="60" Canvas.Left="68" Width="68" MinWidth="68" MinHeight="60" Click="OnClick" DoubleTap="OnButtonDoubleTap" Hold="OnButtonLongPress" Foreground="#FF171717" BorderThickness="0" Style="{StaticResource DateButtonTemplate}" FontFamily="{StaticResource CicleFina}"/>
<Button x:Name="b02" Content="" Height="60" Canvas.Left="136" Width="68" MinWidth="68" MinHeight="60" Click="OnClick" DoubleTap="OnButtonDoubleTap" Hold="OnButtonLongPress" Foreground="#FF171717" BorderThickness="0" Style="{StaticResource DateButtonTemplate}" FontFamily="{StaticResource CicleFina}"/>
<Button x:Name="b03" Content="" Height="60" Canvas.Left="204" Width="68" MinWidth="68" MinHeight="60" Click="OnClick" DoubleTap="OnButtonDoubleTap" Hold="OnButtonLongPress" Foreground="#FF171717" BorderThickness="0" Style="{StaticResource DateButtonTemplate}" FontFamily="{StaticResource CicleFina}"/>
<Button x:Name="b04" Content="" Height="60" Canvas.Left="272" Width="68" MinWidth="68" MinHeight="60" Click="OnClick" DoubleTap="OnButtonDoubleTap" Hold="OnButtonLongPress" Foreground="#FF171717" BorderThickness="0" Style="{StaticResource DateButtonTemplate}" FontFamily="{StaticResource CicleFina}"/>
Any idea why this is happening?
Alfah
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过捕获第一次单击和第二次单击解决了该问题。
检查发件人的姓名,仅当两者姓名相同时才执行该功能。
第一次点击是在 OnClick 函数上捕获的,第二次点击是在 OnDoubleTap 函数上捕获
的
I have solved the problem by capturing the first click and the second click.
Check the names of the sender and do the function only if both has the same.
The first click is captured on the OnClick function and the second at the OnDoubleTap function
Alfah