7

我开始使用触摸屏进行一些测试,我发现如果 UIControl 的“IsManipulationEnabled”属性设置为 true,则不会捕获由按住手势 (WIN7) 触发的 MouseRightClick 事件。难道我做错了什么?

public MainWindow()
    {
        InitializeComponent();
        WC_Rectangle.IsManipulationEnabled = true;
        WC_Rectangle.MouseRightButtonUp += new MouseButtonEventHandler(WC_Rectangle_MouseRightButtonUp);
    }

    void WC_Rectangle_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
    {
        System.Diagnostics.Debug.WriteLine("RIGHT CLICK : " + sender.ToString());
    }
4

3 回答 3

2

设置后,IsManipulationEnabled = true;所有触摸事件都由 WC_Rectangle 捕获和处理,该 WC_Rectangle 将它们转换为操作事件。因此,触摸事件不会返回到引发它们的控件,这反过来意味着控件不能将未处理的触摸事件提升为鼠标事件(默认值)。看:

http://nui.joshland.org/2010/04/why-wont-wpf-controls-work-with-touch.html

于 2013-11-15T09:42:32.093 回答
2

如果您取消操作事件,您应该获得鼠标事件。

于 2014-08-14T06:40:09.797 回答
-2

改用行为

于 2010-10-19T20:21:14.677 回答