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. Image for the cookie policy date
close icon

Is it possible to use SfEffectsView with SfListView swiping?

I want to have a decorated tap effect along with a swipe gesture that will quick delete items in my SfListView. Is it possible to use the SfEffectsView with SfListView swiping? I have tried wrapping my SfEffectsView inside of a ViewCell and a Grid but I'm still not able to trigger the swipe event with the SfEffectsView as my DataTemplate's "Background" container. Whenever I remove the SfEffectsView from the DataTemplate, the swipe event and animation are triggered as intended. Will I need to pick between having an animated item tap event and an animated swipe event or is there a way to have both?


I know that I can utilize the SfListView's SelectionBackgroundColor and SelectionChanged properties to highlight the user's selection temporarily before I navigate but I think the SfEffectsView animation looks better. If I can achieve this behavior now or through a future Nuget Update, amazing! If not, I would like to know so that I can find an alternative.


Also, I forgot to mention that all of this is wrapped inside of a SfPopupLayout.Content if that makes any difference.


Thanks,

Bryson


3 Replies

VV Vijayakumar Viswanathan Syncfusion Team March 13, 2023 02:45 PM UTC

Hi Bryson,

Thanks for contacting Syncfusion support.

We would like to let you know that, SfListView allows you to use the visual effect by setting the Visual element as “Material ”, which uses the effects on tap and allows you to swipe and select the listview item. We have attached the sample, code snippet, and documentation for your reference. Please have a look at the sample and let us if you have any concerns.


Code snippet:

In XAML:

<ContentPage xmlns=http://xamarin.com/schemas/2014/forms

        xmlns:x=http://schemas.microsoft.com/winfx/2009/xaml

        Visual="Material">

<ContentPage.BindingContext>

<local:ViewModel />

</ContentPage.BindingContext>

 

<ContentPage.Behaviors>

<local:Behavior/>

</ContentPage.Behaviors>

   

<Grid RowSpacing="0" ColumnSpacing="0" Padding="0" Margin="0">

<sync:SfListView x:Name="listView" AutoFitMode="Height"

                    SwipeStarted="listView_SwipeStarted"

                    SwipeEnded="listView_SwipeEnded"

                    SelectionChanged="listView_SelectionChanged"

                    ItemsSource="{Binding BookInfo}" 

                    SelectionBackgroundColo


In C#:

public class ItemGeneratorExt : ItemGenerator

{

public ItemGeneratorExt(SfListView listview) : base(listview)

{

 

}

protected override ListViewItem OnCreateListViewItem(int itemIndex, ItemType type, object data = null)

{

    if (type == ItemType.Record)

        return new ListViewItemExt(type);

    return base.OnCreateListViewItem(itemIndex, type, data);

}

}


public class ListViewItemExt : ListViewItem

    {

        public ListViewItemExt()

        {

        }

        public ListViewItemExt(ItemType type) : base(type)

        {

 

        }

        protected override void OnItemAppearing()

        {

            this.Opacity = 0;

            this.FadeTo(1, 400, Easing.SinInOut);

            base.OnItemAppearing();

        }

    }


KB Link: https://www.syncfusion.com/kb/11468/how-to-work-with-material-visual-for-custom-listview-in-xamarin-forms-sflistview


Attachment: ListViewXamarin_8058fbf.zip


KB Kin Bueno April 21, 2023 09:58 AM UTC

Not that classes are proposed synched as fusion in cold fusion or in .net

http://cryphosnegative.blogspot.com/



PR Preethi Rajakandham Syncfusion Team April 24, 2023 07:36 AM UTC

Hi Kin Bueno,

Could you please explain your requirements in detail? This would be helpful for us to serve you.

Regards,

Preethi R


Loader.
Live Chat Icon For mobile
Up arrow icon