lilcodelab / Xamarin.Plugin.Calendar

Calendar plugin for Xamarin.Forms
MIT License
260 stars 60 forks source link

[Custom] SwipeEvent #10

Closed bcaceiro closed 5 years ago

bcaceiro commented 5 years ago

How can I deactivate the SwipeUp gesture from this calendar? I want to override it / disable, to call my own SwipeGesture in my view, is it possible?

PenguinPero commented 5 years ago

With current version I think there is no way

And since I don't know your exact needs and situation I will try to make some guesses Here are few options:

Also is this an issue on both platforms or specific to Android/iOS?

bcaceiro commented 5 years ago

The last option is the better, tbf, or, expose the event, so I could have my SwipedUp implementation.

This is for Android and iOS.

Thanks!

PenguinPero commented 5 years ago

I added both, although I will test the iOS version tomorrow

Available properties will be:

DisableSwipeDetection="True"
SwipeUpActionEnabled="False"
SwipeUpCommand="{Binding SwipeUpCommand}"

I will run the build/nuget push now, you might be able to test iOS before me Swipe-Left/Right I will leave as todo

PenguinPero commented 5 years ago

1.0.3.44 will contain the new functionalities Let me know if this solves the issue for you :)

bcaceiro commented 5 years ago

It is almost perfect, thank you so much for the support.

   SwipeUpCommand?.Execute(null);

            if (SwipeUpActionEnabled)
                ToggleCalendarSectionVisibility();

In this method, you should override the SwipeUpCommand, and not invoke the ToggleCalendarSectionVisibility, if there was a SwipeUpCommand defined. At this moment, I have detected my swipe, however, it is still hiding the calendar, which I don't want (at least not your default method)

PenguinPero commented 5 years ago

I made it so that you can set:

SwipeUpActionEnabled="false" SwipeUpCommand="-your command binding-"

This way you will override it So the logic is: SwipeUpCommand is always called on swipe-up, while default behavior can be disabled with SwipeUpActionEnabled

Sorry if it wasn't clear

bcaceiro commented 5 years ago

Oh, you are right. Well, I've managed to do what I needed. Thank you so much!

PenguinPero commented 5 years ago

Maybe I will rename it to SwipeUpToHideEnabled to make it clearer that it only disables the default behaviour so If everything works for you we can close the issue?

I will add a feature request issue for remaining todos for other direction swipe overrides

bcaceiro commented 5 years ago

Yes, that would make it more clear.

Indeed having all actions bindable would be great. Would serve all purposes for anyone.

thanks again.