GonzaloFJ
GonzaloFJ

Reputation: 85

WPF control does not capture the press and hold event (right click) when IsManipulationEnabled is set

I'm starting to make some tests with a touch screen and I've found that if a UIControl has the "IsManipulationEnabled" attribute set to true then the MouseRightClick Events fired by the press and hold gesture (WIN7) is not captured. Am I doing something wrong?

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());
    }

Upvotes: 7

Views: 2816

Answers (3)

tziemek
tziemek

Reputation: 61

If you cancel the manipulation events you should get the mouse events.

Upvotes: 2

Firo
Firo

Reputation: 30813

After setting IsManipulationEnabled = true; all touchevents are captured and handled by the WC_Rectangle which does transform them to Manipulation events. So the touchevents do not tunnel back to the control that raised them which in turn means the control can't promote unhandled touch events to mouse events (the default). see:

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

Upvotes: 3

NYC Real Estate
NYC Real Estate

Reputation: 1

Use Behavior Instead

Upvotes: -2

Related Questions