Open HarryLobster opened 4 years ago
Thanks for the suggested enhancement @HarryLobster. Actually, you can programmatically open the SwipeView using:
swipeView.Open(OpenSwipeItem.LeftItems);
And close it with:
swipeView.Close();
Related, recently the IsOpen
property has also been added to SwipeEndedEventArgs
. In this way, you can know if the SwipeView is open or closed when you stop swipping.
What would better cover this enhancement better, have a Closed
event that is fired always when the SwipeView is closed?
As well as @HarryLobster I would really appreciate having some event to track changes of IsOpen
property. The thing is that SwipeEnded
event is only called when I am swiping to open the view, but when I am closing it (either by tap or by swipe) nothing is called. It allows to learn when swipe view state changes from Closed to Open, but not vice versa.
In my use case I need to change state of some elements inside the swipe view depending on whether it is open or closed (by the user). To achieve it right now I am adding a tap and a few swipe gesture recognizers and inside of them I am assuming that if the view was open it's state is about to change to closed. It kind of works (though looks a bit hacky) but some cases of swipe view being closed are still not covered with this approach.
So it would be awesome if some sort of Closed
or IsOpenChanged
event was introduced that would fire every time when the state is actually changing.
Thanks for the suggested enhancement @HarryLobster. Actually, you can programmatically open the SwipeView using:
swipeView.Open(OpenSwipeItem.LeftItems);
And close it with:swipeView.Close();
Related, recently the
IsOpen
property has also been added toSwipeEndedEventArgs
. In this way, you can know if the SwipeView is open or closed when you stop swipping.What would better cover this enhancement better, have a
Closed
event that is fired always when the SwipeView is closed?
Yes, that would solve my problem and it is logical for me that this should be implemented anyways !?
As well as @HarryLobster I would really appreciate having some event to track changes of
IsOpen
property. The thing is thatSwipeEnded
event is only called when I am swiping to open the view, but when I am closing it (either by tap or by swipe) nothing is called. It allows to learn when swipe view state changes from Closed to Open, but not vice versa.In my use case I need to change state of some elements inside the swipe view depending on whether it is open or closed (by the user). To achieve it right now I am adding a tap and a few swipe gesture recognizers and inside of them I am assuming that if the view was open it's state is about to change to closed. It kind of works (though looks a bit hacky) but some cases of swipe view being closed are still not covered with this approach.
So it would be awesome if some sort of
Closed
orIsOpenChanged
event was introduced that would fire every time when the state is actually changing.
I'm using Xamarin.Forms 4.8.0.1364 and SwipeEnded event is NOT firing when SwipeView is closed on Android. Only when its opened (obviously isOpen is always true). SwipeStarted is also fired only during opening.
@hairatic @jsuarezruiz I am using xam forms 5.0 pre-1, and I can confirm the same behaviour on Android - swipe ended only fires when opening the swipe view, not closing it. So I am unable to reliably know the open/closed state of the swipe view at any point in time. In fact there appear to be various problems with all of the exposed swipe events, as follows.
CloseRequested - never fires when swiping OpenRequested - never fires when swiping SwipeChanging - only fires on swiping to open, not swiping to close SwipeEnded - only fires on swiping to open, not swiping to close SwipeStarted -only fires on swiping to open, not swiping to close
My swipe view is inside a collectionview, running on an android physical device, samsung galaxy A30, android 10.
Although working versions of these events would be useful for me, what I am really looking for is an INotifyPropertyChanged boolean "IsOpen" on the swipe view itself, that I could check and bind UI bindable properties against.
@hairatic @jsuarezruiz I am using xam forms 5.0 pre-1, and I can confirm the same behaviour on Android - swipe ended only fires when opening the swipe view, not closing it. So I am unable to reliably know the open/closed state of the swipe view at any point in time. In fact there appear to be various problems with all of the exposed swipe events, as follows.
CloseRequested - never fires when swiping OpenRequested - never fires when swiping SwipeChanging - only fires on swiping to open, not swiping to close SwipeEnded - only fires on swiping to open, not swiping to close SwipeStarted -only fires on swiping to open, not swiping to close
My swipe view is inside a collectionview, running on an android physical device, samsung galaxy A30, android 10.
Although working versions of these events would be useful for me, what I am really looking for is an INotifyPropertyChanged boolean "IsOpen" on the swipe view itself, that I could check and bind UI bindable properties against.
It seems that 5.0.0.1558-pre3 has the same problems...
Can we get this reclassified as a bug since none of events correctly fire on Android? I am afraid that tit may not get the proper visibility due to it being labeled as an enhancement.
I have done some tests using Xamarin.Forms 5.0 in a Device using Android 10:
The results:
Is that your expected behavior?
Thanks @jsuarezruiz . I have upgraded to 5 pre3 and I get the same behaviour now. However SwipeChanging, SwipeEnded and SwipeStarted only seem to fire when opening the item. Once the item is open, upon swiping to close, none of the events fire. Is this expected behaviour?
However SwipeChanging, SwipeEnded and SwipeStarted only seem to fire when opening the item. Once the item is open, upon swiping to close, none of the events fire. Is this expected behaviour?
Hi @jsuarezruiz, I see the exact same behaviour on iOS 14.5 using Xamarin.Forms 5.0.0.2012. Is there a fix on the horizon?
I have the same behaviour. It should be that SwipeEnded is fired when the swipe item is closed. Is there going to be a fix for this?
@jsuarezruiz I've noticed that SwipeEnded works for the swipe item being closed only when it isn't fully opened in the first place. If your video above continued, it wouldn't have shown SwipeEnded when you were closing the swipeview item.
If I swipe the view but don't swipe it all the way, SwipeEnded will be triggered. I'd like SwipeStarted to be triggered no matter where you are in the swipe. It seems to only be working when the swipe view is in its default position. Similarly, SwipeEnded only gets triggered when you are starting from the default position or you swipe from one side across the middle to the other side.
I´m experiencing the same behaviour as @stavroaudisho. Is there going to be a fix? It would be nice if SwipeEnded event triggers if SwipeView closes.
Having the same issue. I would also appreciate a fix for this.
Works for Android, not for iOS.
On a side note; I was a bit surprised by this API as most other controls have a simple IsOpen property that you can use in a property changed scenario. SwipeEnded + IsOpen works (if it worked for both platforms), but it's kinda different than most other controls IMO.
I tried to listen to property changed in general for both the SwipeView and the content of the SwipeView. On iOS there is no event to hook on to when you close it, which is really disapointing.
A potential workaround I tried was: Use Xamarin Community Toolkit Lifecycle effects on the content of the SwipeView to get Loaded/Unloaded events. This also worked on Android, but not for iOS.
Is there any update on this? As far as I can see it's currently impossible to determine if the SwipeView has been swiped closed.
I have the same issue. Did manage to create a new ticket before I found this thread (https://github.com/xamarin/Xamarin.Forms/issues/15194 ). Is there a solution in sight?
I have the same issue
@jsuarezruiz has there been any progress on this item?
Any progress? I can's think why there is't a IsOpen
property... such a ez thing...
I am missing a Close-Event for the SwipeView if it is generally closing e.g. by tapping on the form. There is only the event CloseRequested that only fires if I close the SwipeView programatically. I want to use the SwipeView in a ListView-Scenario and would like to lock the ListView while the SwipeView is open.