触摸我的对象时为什么会触发Stylus和Mouse事件?

时间:2015-05-07 14:02:41

标签: c# wpf events touch

我有一个PushPin对象,我已经连接了一些Touch / Stylus / Mouse事件:

pp.MouseDown += pp_MouseDown;
pp.TouchDown += pp_TouchDown;
pp.TouchUp += pp_TouchUp;
pp.StylusDown += pp_StylusDown;
pp.StylusUp += pp_StylusUp;

处理程序

    void pp_MouseDown(object sender, MouseButtonEventArgs e)
    {
        PushPinUpOrDown(sender);
        e.Handled = true;
    }

    private void pp_TouchDown(object sender, TouchEventArgs e)
    {
        var pushpin = (sender as Pushpin);
        pushpin.CaptureTouch(e.TouchDevice);
        e.Handled = true;
    }

    void pp_StylusDown(object sender, StylusDownEventArgs e)
    {
        var pushpin = (sender as Pushpin);
        pushpin.CaptureStylus();
        e.Handled = true;
    }

    void pp_StylusUp(object sender, StylusEventArgs e)
    {
        var pushpin = (sender as Pushpin);
        e.Handled = true;
        if (pushpin != null && e.StylusDevice.Captured == pushpin)
        {
            PushPinUpOrDown(sender);
            pushpin.ReleaseStylusCapture();
        }

    }

    void pp_TouchUp(object sender, TouchEventArgs e)
    {
        var pushpin = (sender as Pushpin);
        e.Handled = true;
        if (pushpin != null && e.TouchDevice.Captured == pushpin)
        {
            PushPinUpOrDown(sender);
            pushpin.ReleaseTouchCapture(e.TouchDevice);

        }
    }

但是当我触摸PushPin时,StylusDown事件会先触发,然后是MouseDown。我希望发射的TouchDown事件永远不会发生。

这是为什么?这是我的程序或我的显示器的问题?

我是否需要Stylus和Touch活动?

(我正在使用支持触控的显示器而不是平板电脑或其他任何东西)

0 个答案:

没有答案