- Home
- Forum
- Xamarin.Forms
- Disable swiping past the last card [SOLVED]
Disable swiping past the last card [SOLVED]
Hi there,
Attachment: cards_4fbe6929.zip
I am using a SfCardLayout that has 1 to 10+ cards. I have it set up that the user swipes through the cards like a carousel (the cards don't dismiss). However, when the user swipes the last card, the layout is left empty and it looks odd.
See attached zip file. cards1.png looks great but when the user swipes past the last card they end up with a screen that looks like cards2.png.
How do I prevent the user from swiping past the last card? I always want there to be a card on screen.
Thanks,
Ronan
Attachment: cards_4fbe6929.zip
SIGN IN To post a reply.
5 Replies
RA
Rachel A
Syncfusion Team
October 30, 2019 06:41 AM UTC
Hi Ronan,
Greetings from Syncfusion.
We have achieved your requirement using the VisibleCardIndexChanging event in the SfCardLayout. Please find the sample for your reference.
Sample:https://www.syncfusion.com/downloads/support/directtrac/241231/ze/WorkingWithCard1078693785.zip
Code Snippet:
Xaml:
|
<cards:SfCardLayout VisibleCardIndexChanging="CardVisibleCardIndexChanging">
|
C#:
|
void CardVisibleCardIndexChanging(object sender, VisibleCardIndexChangingEventArgs e)
{
e.Cancel = e.NewCard == null;
}
|
Please let us know if you need further assistance on this.
Thanks,
Rachel.
RB
Ronan Burke
October 30, 2019 08:55 AM UTC
Hi Rachel,
Thank you very much, this solution works perfectly!
Thanks,
Ronan
RA
Rachel A
Syncfusion Team
October 30, 2019 08:56 AM UTC
Hi Ronan,
Thanks for the confirmation.
Please let us know if you have any other queries.
Thanks,
Rachel.
PE
Pedro
February 20, 2020 09:39 AM UTC
Hello
void CardVisibleCardIndexChanging(object sender, VisibleCardIndexChangingEventArgs e) { e.Cancel = true; } |
Is there any other way to disable swipping?
Thanks
SJ
Suyamburaja Jayakumar
Syncfusion Team
February 21, 2020 12:50 PM UTC
Hi Pedro,
Currently we don’t have another solution for disable swipping. we will update you in future once we got a better solution than previous update.
Regards,
Suyamburaja J.
SIGN IN To post a reply.
- 5 Replies
- 4 Participants
-
RB Ronan Burke
- Oct 29, 2019 04:14 PM UTC
- Feb 21, 2020 12:50 PM UTC