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

LISTVIEW LeftSwipeTemplate & MVVM

Thread ID:

Created:

Updated:

Platform:

Replies:

144131 Apr 20,2019 10:06 PM UTC Jul 17,2020 04:51 AM UTC Xamarin.Forms 9
loading
Tags: SfListView
Bamame
Asked On April 20, 2019 10:06 PM UTC

Hi,
Do you have a sample project that shows how to use SFListView swipetemplate with MVVM. The SFListView must have 2 entry controls in the datatemplate (entry1 & entry2) and 2 button controls in the leftswipetemplate (button1 & button2). Each button needs to fire a command in the ViewModel. When button1 on a specific row is clicked, it needs to reset values of entry1 & entry2 to "UNKNOWN" (for that specific row) as well as update the itemsource data. I will also like to see a sample where at the click on a button on the page, all rows for entry1 and entry2 will be set to "UNKNOWN" (something like a reset all button) as well as update the itemsource data. 

I have gone through the documentation and forums and seen different examples that have one or more features described above but have not been able to tie everything together to get what I want. Is this even do-able using MVVM?

Thanks in advance!

Dinesh Babu Yadav [Syncfusion]
Replied On April 22, 2019 11:01 AM UTC

Hi Bamame,  
  
Thanks for using Syncfusion products.  
  
We have checked your requirement from our end. We have prepared the sample based on the information given by you and changed the entry value of the swiped item. We have attached the sample for your reference and you can download it from the below link.  
  
  
Please let us know if you require further assistance on this.  
  
Regards,  
Dinesh Babu Yadav.  



Bamame
Replied On April 24, 2019 11:30 PM UTC

This is really helpful. Thanks a lot!

Dinesh Babu Yadav [Syncfusion]
Replied On April 25, 2019 04:33 AM UTC

Hi Bamame, 
 
Thanks for the update. Please let us know if you require further assistance. 
 
Regards, 
Dinesh Babu Yadav 


Jordan
Replied On August 15, 2019 07:10 PM UTC

Hi there,

Is it possible to use a button in the swipe template? I've tried and the app crashes. Stack Trace attached:

Image works but button crashes the app.

I;ve tried to paste the template code here but it won;'t allow

Thanks in advance

Jordan
Replied On August 15, 2019 07:10 PM UTC

Stack trace

Attachment: listview_button_swipe_ce867131.zip

Jordan
Replied On August 15, 2019 07:11 PM UTC

<listview:SfListView.LeftSwipeTemplate>
                        <DataTemplate x:Name="offlineJobLeftSwipeTemplate">
                            <Grid HorizontalOptions="Center" VerticalOptions="Center">
                                
                                <Image BackgroundColor="Transparent" HeightRequest="35" Source="delete.png" WidthRequest="35">
                                    <Image.GestureRecognizers>
                                        <TapGestureRecognizer Command="{Binding BindingContext.RemoveJobCommand, Source={x:Reference Name=offlineJobsListViewSf} }" CommandParameter="{Binding}" />
                                    </Image.GestureRecognizers>
                                </Image>

                                <!--<Button Text="&#xf2ed;"
                                    TextColor="White"
                                    FontSize="32"
                                    Padding="0"
                                    HorizontalOptions="CenterAndExpand"
                                    VerticalOptions="CenterAndExpand"
                                    BackgroundColor="Transparent"
                                    Command="{Binding BindingContext.RemoveJobCommand, Source={x:Reference Name=offlineJobsListViewSf} }"
                                    CommandParameter="{Binding .}"
                                    FontFamily="{StaticResource FontAwesomeRegular}" />-->

                            </Grid>
                        </DataTemplate>
                    </listview:SfListView.LeftSwipeTemplate>

Sangeetha Raju [Syncfusion]
Replied On August 19, 2019 12:04 PM UTC

Hi Jordan, 
 
We have checked the reported query “Crash occurs when using button in SwipeTemplate” from our side. We would like to let you know that we didn’t face any crash as reported while using button with command. We have attached the tested sample for your reference. Please download the sample from the below link. 
 
 
Could you please check with the above sample and please revert us with reproducible/modified sample which will be helpful for us to analyze the issue cause and provide appropriate solution at our end. 
 
Please let us know if you have any concern. 
 
Regards,
Sangeetha Raju.
 


Steven Marcus
Replied On July 16, 2020 07:19 PM UTC

Sorry to bring up an old thread but wanted to thank the Syncfusion team for the sample MVVM code

http://www.syncfusion.com/downloads/support/forum/144131/ze/Swiping1487684542

It was super helpful!!!! Love it.!

Lakshmi Natarajan [Syncfusion]
Replied On July 17, 2020 04:51 AM UTC

Hi Steven, 
 
We are very glad to have your valuable feedback and appreciation :). Please get back to us if you need any other assistance. As always we will be happy to assist you.  
  
Regards, 
Lakshmi Natarajan 
 


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