Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Swipe programmaticallyitem in list view

guizmoguizmo Member ✭✭

Hi,

How do I swipe item programmatically in list view ? For example : If I have an item with a swipe menu instead of swipping with touch gesture I want to swipe the item programmatically when clicking on a button display on my cell items. I could add a command for my button but How can I swipe the specific item where the user is clicking on the button.

Best Answer

Answers

  • LardeCristoLardeCristo Member ✭✭

    Hey, you look this video.... +-11:00

    https://youtube.com/watch?v=wmZCtaBel8A

  • JarvanJarvan Member, Xamarin Team Xamurai
    edited June 15

    How do I swipe item programmatically in list view ?

    How did you achieve the swipe function? Try using the SwipeView control. The class includes Open and Close methods, which programmatically open and close the swipe items, respectively.

    Check the code:

    <SwipeView>
        <SwipeView.LeftItems>
            <SwipeItems>
                <SwipeItemView>
                    ...
                </SwipeItemView>
            </SwipeItems>
        </SwipeView.LeftItems>
        <!-- Content -->
    </SwipeView>
    

    Swipe in code behind:

    swipeView.Open(OpenSwipeItem.LeftItems);
    
    swipeView.Close();
    

    Tutorial:
    https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/swipeview#custom-swipe-items

  • guizmoguizmo Member ✭✭

    I achieve the swipe function by clicking on a button located in my list view item template.

    I will try to manage this by creating a command for opening the current swipe view. Then when the user will click on the button the swipe view command will be triggered

    Thank you

Sign In or Register to comment.