【问题标题】:Prevent phone from sending MouseLeftButtonUp event while scrolling防止手机在滚动时发送 MouseLeftButtonUp 事件
【发布时间】:2014-09-03 07:30:26
【问题描述】:

如何防止 windows phone 7 在用户滚动时向我的 Grid(我用作按钮)发送 MouseLeftButtonUp 事件?

这个问题有时会导致在用户滚动时导航到另一个页面。

或者我应该为此使用按钮模板吗?

示例代码:

<ScrollViewer>
    <StackPanel>
        <Grid x:Name="Button1" MouseLeftButtonUp="Button1_LeftMouseButtonUp">
            <TextBlock Margin="12 15" />
        </Grid>
    </StackPanel>
</ScrollViewer>

【问题讨论】:

  • 你找到解决办法了吗?
  • 我使用了一个带有 ControlTemplate 的按钮。

标签: silverlight windows-phone


【解决方案1】:

试试这个而不是 LeftMouseButtonUp 事件

private void Button1_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
{
    if (!e.IsInertial)
    {
        //Button Click Code
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多