我遇到一个问题,我的按钮(有图像背景)不会在每次点击屏幕时触发点击事件(有时每次都会触发,有时一次点亮3-4次我点击屏幕上的按钮) 。项目针对WP7.1。
按钮在XAML中定义为:
<Button x:Name="Menu" Tap="Menu_Tap" Height="70" Width="70" Margin="0,0,0,0" HorizontalAlignment="Center" Padding="0" VerticalAlignment="Center" Style="{StaticResource MenuImageButtonStyle}"></Button>
定义菜单背景图片的样式:
<Style x:Key="MenuImageButtonStyle" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Image x:Name="StartButtonImage" Source="/Images/menu_button.png" Height="33" Width="33" />
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content=""/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
请注意,我已经通过使用Tap,Click和ManipulationStarted事件进行了实验,但没有运气,所有事件都不稳定。 我很确定这个问题不是我的攻丝精度,我一定要点击按钮的中心。我在诺基亚Lumia 800上测试过。
此处提供整个项目代码: http://notecase.sourceforge.net/temp/wp7Issue.zip
任何想法,为什么会这样?有任何提示要解决这个问题吗?