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:
StylusDown
StylusButtonDown
TouchDown
StylusUp
StylusButtonUp
Click
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?
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.
Related
I am developing a solution that will be used solely on touch computers. Should I use Click, TouchDown, PreviewTouchDown to listen to the event of clicking the button on the touchscreen using touch? Originally I was using Click but I noticed in some cases that the event didnt fire on first finger tap on the touch screen and had to touch it again to fire. I am using .NET 4.8. Thanks!
If you handle the TouchDown and also set the Stylus.IsPressAndHoldEnabled attached property of the Button to false, the event should be raised as soon as the finger touches the screen:
<Button Content="Touch" TouchDown="Button_TouchDown" Stylus.IsPressAndHoldEnabled="False" />
By default and as stated in the docs, the event doesn't occur until a finger touches the screen and moves.
Instagram has a really cool interaction where you can tap-and-hold, aka longPress, on an image and an interactive pop-up appears. Once it appears you can drag your finger to one of the action buttons and removing your finger applies the action and closes the pop-up.
Here it is in action.
And here's a link to a video if you need a closer look.
In my app I've got the tap-and-hold popup working, but the finger drag continues to control the underlying View.
How do you get the finger interaction to transfer to the pop-up?
How do you get the buttons responding to finger drag-over?
This is something you can achieve with PanResponder. Using Pan Responder you are basically creating your own touchable components. Click here for the docs.
Also, you would need the Animated API for animating the transitions.
I am looking to handle the click event on a Telerik Label control in a Silverlight application, but cannot find a click event attribute setting. DoubleClick is catered for (it appears in Intellisense), but not Click. Surely I am missing something obvious here, but I cannot find it.
I tried adding a Click event handler using Caliburn Micro, but that isn't firing either. It's as though the Telerik Label control stubbornly doesn't want to respond to being (single) clicked.
Any advice would be appreciated.
I have a WPF application with some content wrapped in a scrollviewer. I also have a custom dialogbox, which basically is a light customized Window I call ShowDialog() upon.
I can use this just fine on both PC and Tablet.
But now I´ve added the PanningMode attribute to the scrollviewer, so the Tablet users can scroll/swipe with their finger, and now the problem occurs: when I use my dialogbox it shows up, but it seems like it doesent have focus. Because the first time I click on a button in the dialogbox, nothing happens. I have to click twice before the button click is registered.
If I remove the panningmode attribute on the scrollviewer, the problem is gone.
This is only a problem on the Tablet, not on the PC.
Any clues?
I found the problem.
I was triggering the dialogbox in mousedown on an image. Tried several events, but the StylusUp did the trick.
I have a Silverlight application that is using the Navigation Framework. The page is never focused right after it is navigated too. So when I first click on a button, it does nothing (except focus the page). Only the second click after navigation works. I use a subclass of the Page and have hooked the GotFocus event. It is never called. I've also tried to call the Focus method a handler for the Loaded event and the override to OnNavigatedTo. Nothing works. The GotFocus handler is never called until I actually click somewhere in the view. My clients are not going to accept this. Is this a bug with the Navigation Framework, is there a work around?
Thanks for you help.