wpftemplatestouchstylus-pen

Reacting to StylusDown in control's UI?


I'm building a touch screen application in WPF and I'm wanting to show a change in UI when the user presses a button with their finger/stylus. Currently you only get a flicker of UI change once the finger is released but nothing before that.

I've been trying to hook up triggers and/or eventtriggers in the button template to things like stylusdown and touchdown but to no avail.

I've hooked up some console writes on events attached to a button and they appear in the following order:

All of which firing at the same time when the finger is lifted from the screen. (TouchUp doesn't seem to fire at all).

Any ideas on how I could begin to capture a finger pressing onto a button in the template so I can give the user some idea that they are actually pressing a button?


Solution

  • After blogging in more detail about this issue I had a comment recommending using a SurfaceWindow and then SurfaceButtons from the Surface Toolkit (currently in Beta) and now all is working as I would expect.

    Update: The link is now dead. Here's the link to that page from Wayback Machine.