Adventure Mania
Adventure Mania

Reputation: 15

Xamarin swipeview, when you swipe again, it returns to the position of the last. What is this?

If you swipe several times on an already opening field, then after closing the swiped element will return to the position from which the last swipe was.

For example: enter image description here

I upload project for replay problem: link

XAML Code:

    <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="TestSwipeView.MainPage">
<CollectionView x:Name="collectionView"
                ItemsSource="{Binding TestSequence}">
    <CollectionView.ItemTemplate>
        <DataTemplate>
            <SwipeView>
                <SwipeView.LeftItems>
                    <SwipeItems>
                        <SwipeItem Text="F"
                                   
BackgroundColor="LightGreen"/>
                        <SwipeItem Text="D" 
 BackgroundColor="LightPink"/>
                    </SwipeItems>
                </SwipeView.LeftItems>
                <Grid BackgroundColor="White"
                      Padding="10">
                    <Label Text="{Binding .}"></Label>
                </Grid>
            </SwipeView>
        </DataTemplate>
    </CollectionView.ItemTemplate>
</CollectionView>
</ContentPage>

Xaml.cs code:

 namespace TestSwipeView
{
    public partial class MainPage : ContentPage
    {
        public List<String> TestSequence { get; set; }
        public MainPage()
        {
            TestSequence = new List<string>();
            for (int i=0; i<10; i++)
            {
                TestSequence.Add(String.Format("Test {0}",i));
            }
            InitializeComponent();
            this.BindingContext = this;
        }
    }
}

Upvotes: 0

Views: 341

Answers (0)

Related Questions