-
Notifications
You must be signed in to change notification settings - Fork 16
TouchEffect
Gulam Ali H edited this page Jan 1, 2024
·
8 revisions
TouchEffects has a property Color that will add a Native animation with the Color you want,
xmlns:freakyEffects="clr-namespace:Maui.FreakyEffects.TouchEffects;assembly=Maui.FreakyEffects"
<ContentView
.
.
.
.
freakyEffects:TouchEffect.Color="Green"/>
In case it does not work on a control then wrap it in a ContentView:
<ContentView
freakyEffects:TouchEffect.Color="Green">
<Border
.
.
.
/>
</ContentView>
Known issues or conditions where it might not work:
- The effect only works with Layouts and not Controls which means you need to have a View that is a container and not a control for this to work, in case you try to use it on a Control an InvalidOperationException will be thrown. this is because it's tough to add these effects on Controls directly because of some native limitations.
- There are scenarios where you need to manually set the InputTransparent property of certain controls to True for this to work since these controls tend to consume the click event(become first responders). A good example of such views is pretty much anything that derives from SkiaSharp's SkCanvasView.
- The effect does not work on Border control (It has a weird behaviour not sure if this has something to do with MAUI but you need to wrap them in another layout Like Stack or Grid or even ContentView)
- The effect may not work in views with other inbuilt gestures and effects like Buttons, Slider, Picker, Entry, Editor, etc.
- The effect may not work correctly with standard gestures in .NET MAUI, If you need some gestures with touch effects, use not GestureRecognizer, but Commands in this Library. which you can access from the same namespace btw the example is available in the FreakyEffects. There is an option to add Tap and LongTap.