Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If parent element have gesture and child element have touch effect disabled the child element override parent's gesture #78

Closed
KyrillosS25 opened this issue Oct 20, 2020 · 12 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@KyrillosS25
Copy link

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?

ezgif-7-6981f1ba6b72

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>
`
@AndreiMisiukevich
Copy link
Owner

Try to set InputTransparent to your child StackLayout

@AndreiMisiukevich
Copy link
Owner

That's not TouchEff problem. If you remove TouchEffect at all and just leave a child stack layout the behavior will remain the same

@AndreiMisiukevich AndreiMisiukevich added the question Further information is requested label Oct 20, 2020
@KyrillosS25
Copy link
Author

Try to set InputTransparent to your child StackLayout

I tried it and got the same behavior

@KyrillosS25
Copy link
Author

KyrillosS25 commented Oct 21, 2020

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'"

ezgif-7-6981f1ba6b72

`

    <StackLayout  BackgroundColor="Blue" HeightRequest="50" WidthRequest="50" 
                  
                     >
        
    </StackLayout>
    <StackLayout.GestureRecognizers>
        <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"></TapGestureRecognizer>
    </StackLayout.GestureRecognizers>
</StackLayout>

`

@AndreiMisiukevich
Copy link
Owner

Have you tried to set InputTransparent = true?

@KyrillosS25
Copy link
Author

yes

@AndreiMisiukevich AndreiMisiukevich added bug Something isn't working and removed question Further information is requested labels Oct 21, 2020
@AndreiMisiukevich
Copy link
Owner

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);

@KyrillosS25
Copy link
Author

okay thanks, I'll try that.

@KyrillosS25
Copy link
Author

KyrillosS25 commented Oct 21, 2020

@AndreiMisiukevich
the workaround worked. but can I add effects to view from code instead of removing them ?

@AndreiMisiukevich
Copy link
Owner

@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.

@KyrillosS25
Copy link
Author

Thanks

@AndreiMisiukevich AndreiMisiukevich added the help wanted Extra attention is needed label Oct 27, 2020
@AndreiMisiukevich
Copy link
Owner

Now works fine with IsAvailable=False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants