Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF Touch vs WM_TOUCH

$
0
0

I am building a WPF application in which I need to know the size of the TouchPoint on a capacitive screen. I know that the screen I am using is reporting this, as I can capture the raw WM_TOUCH touch points, which report the actual size of the touch point in the TOUCHINPUT struct through the method GetTouchInputInfo()

WPF seems to support this size property, since we can access this property in all Touch events as such:

private void UIElement_OnTouchDown(object sender, TouchEventArgs e)
{
   var size = e.GetTouchPoint(this).Size;
}

Unfortunately, this always returns {0,0}, which makes no sense.

So, after doing some research it seems that WPF by default uses a StylusTouchDevice in which the bounds (and size) of the touch points are calculated. It seems that here, they do not use the reported touch input size, but are looking only at the size of the Stylus input, which I believe in my case to be 0.

As an alternative approach I implemented a WPF TouchWindow that uses the WM_TOUCH messages to grab the touch points. This approach does report the size of the touch point, but you essentially loose all build-in WPF touch support, which makes using this work around cumbersome and undo-able. I tried using a transparent overlay WPF window to pump the WM_TOUCH events into a normal WPF window, but since the overlay window is not visible, it does not received any input events.

My questions:

- how can I access the touch point size property from within the normal WPF StylusTouchDevice? Can I change the default TouchDevice?

- how can I create a WPF window in which I can access both the normal (Stylus) touch events, but also the WM_TOUCH events?

Ps: unfortunately I had to remove the links to documentation as "Body text cannot contain images or links until we are able to verify your account."




Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>