TouchBehavior doesn't work correctly on custom control #3010
Unanswered
Chris-TritonAppworks
asked this question in
Q&A
Replies: 2 comments 1 reply
-
|
@Chris-TritonAppworks is this similar to yours? #2894 |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
Might want to try my control out if you're trying to get the different states - https://github.com/IeuanWalker/Maui.StateButton Not sure how accessible the touch behaviours are |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've built a custom button control, using ContentView as the base. I'm trying to make Press work correctly but finding it impossible. I'm also trying to use VisualStates here. The behavior I'm getting is as follows:
XAML:
Codebehind:
I expect this to put the button into the Pressed state until the user releases the button or lifts their finger, at which point the visual state should return to Normal. I should not have to do that manually. And I certainly don't expect a flurry of exceptions (please chime in if you know why they are happening, maybe that's the cause of this whole mess).
I was surprised that something so fundamental didn't work nicely. Can anyone provide guidance on a working approach or workaround? (I followed the [TouchBehavior sample](https://github.com/CommunityToolkit/Maui/tree/main/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/TouchBehavior))
I don't have much hair left to pull out -- thanks for any help.
Beta Was this translation helpful? Give feedback.
All reactions