If parent element have gesture and child element have touch effect disabled the child element override parent's gesture
Closed this issue · 12 comments
Hello,
I have 2 stacklayout the parent stack have tap gesture and child stack have touch effect with "IsAvailable = 'False'", when tapping on child stack nothing happens.
could I add/remove touch effect form code behind?
Code :
`
<StackLayout BackgroundColor="Red" HeightRequest="100" WidthRequest="100">
<StackLayout BackgroundColor="Blue" HeightRequest="50" WidthRequest="50"
touch:TouchEff.NativeAnimation="False"
touch:TouchEff.IsAvailable="False"
touch:TouchEff.NativeAnimationShadowRadius="10"
touch:TouchEff.NativeAnimationColor="Gray">
</StackLayout>
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"></TapGestureRecognizer>
</StackLayout.GestureRecognizers>
</StackLayout>
Try to set InputTransparent to your child StackLayout
That's not TouchEff problem. If you remove TouchEffect at all and just leave a child stack layout the behavior will remain the same
Try to set InputTransparent to your child StackLayout
I tried it and got the same behavior
That's not TouchEff problem. If you remove TouchEffect at all and just leave a child stack layout the behavior will remain the same
I removed TouchEff from child stack and got the tapped event of the parent, I think that TouchEff somehow override the parent event event if "IsAvailable='False'"
`
<StackLayout BackgroundColor="Blue" HeightRequest="50" WidthRequest="50"
>
</StackLayout>
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"></TapGestureRecognizer>
</StackLayout.GestureRecognizers>
</StackLayout>
`
Have you tried to set InputTransparent = true?
yes
Confirmed that's a bug.
Well, there is a workaround. You can remove the effect from code
var effects = view.Effects.OfType<TouchEff>().ToArray();
foreach (var effect in effects)
view.Effects.Remove(effect);
okay thanks, I'll try that.
@AndreiMisiukevich
the workaround worked. but can I add effects to view from code instead of removing them ?
@AndreiMisiukevich
the workaround worked. but can I add effects to view from code instead of removing them ?
Yes, sure you can :)
view.Effects.Add(new TouchEff());
TouchEff.SetCommand(view, new Command()); // etc.
Thanks
Now works fine with IsAvailable=False