Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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());
    }
like image 987
GonzaloFJ Avatar asked Jun 21 '10 14:06

GonzaloFJ


1 Answers

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

like image 186
Firo Avatar answered Oct 06 '22 23:10

Firo