We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Disable swiping past the last card [SOLVED]

Thread ID:

Created:

Updated:

Platform:

Replies:

148664 Oct 29,2019 04:14 PM UTC Feb 21,2020 12:50 PM UTC Xamarin.Forms 5
loading
Tags: SfCardLayout
Ronan Burke
Asked On October 29, 2019 04:14 PM UTC

Hi there,
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

Rachel A [Syncfusion]
Replied On 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.  
   
   
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. 

Ronan Burke
Replied On October 30, 2019 08:55 AM UTC

Hi Rachel,
Thank you very much, this solution works perfectly!

Thanks,
Ronan

Rachel A [Syncfusion]
Replied On 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. 


Pedro
Replied On February 20, 2020 09:39 AM UTC

Hello

I have tested your solution in order to disable swipping and it's working:

   
void CardVisibleCardIndexChanging(object sender, VisibleCardIndexChangingEventArgs e)  
{  
    e.Cancel = true;  
}  

Is there any other way to disable swipping?

Thanks

Suyamburaja Jayakumar [Syncfusion]
Replied On 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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon