Forum Xamarin.Forms

Problems using ListView with SwipeView overlapping rows

ifoxbrifoxbr Member ✭✭

Hi

I am trying to slide the ListView item to the left to access the Delete button.
When I slide the second line after the first, the first line does not return to the original position and
when I slide the other lines to the left, ONLY the last line is shown correctly, in the lines above the lines are superimposed.

See image

See xaml code

                   <ListView.ItemTemplate >
                        <DataTemplate >
                            <ViewCell >
                                    <SwipeView>
                                        <SwipeView.RightItems>
                                            <SwipeItems Mode="Reveal" >
                                                <SwipeItem Text="Excluir"          
                                                           CommandParameter="{Binding Source={x:Reference Item}, Path=BindingContext}"
                                                           BackgroundColor="Red" 
                                                           IconImageSource="delete.png"
                                                           Invoked ="IB_Invoked">
                                                </SwipeItem>
                                            </SwipeItems>
                                        </SwipeView.RightItems>

                                        <!-- conteudo do swipe view-->
                                        <Frame CornerRadius="20" Margin="1,1,1,1" HasShadow="True"  BorderColor="DarkBlue">
                                            <Grid x:Name="Item">
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="40"/>
                                                </Grid.RowDefinitions>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="50"/>
                                                    <ColumnDefinition Width="*"/>
                                                    <ColumnDefinition Width="60"/>
                                                    <ColumnDefinition Width="90"/>
                                                </Grid.ColumnDefinitions>

                                                <Grid BackgroundColor="Blue">
                                                    <Label Grid.Row="0" Grid.Column="0" Text="{Binding QTY}"  Font="20" VerticalOptions="Center" HorizontalTextAlignment="Center" TextColor="White" />
                                                </Grid>
                                                <StackLayout Grid.Row="0" Grid.Column="1" Orientation="Horizontal">
                                                    <Label Text="{Binding DESCRIPTION}" VerticalTextAlignment="Center" Font="14" TextColor="Black" />
                                                </StackLayout>
                                                <StackLayout Grid.Row="0" Grid.Column="2" Orientation="Horizontal" HorizontalOptions="End">
                                                    <Label Text="{Binding TOTAL, StringFormat='{0:N2}'}" VerticalTextAlignment="Center" Font="14" TextColor="Black" />
                                                </StackLayout>
                                            </Grid>
                                        </Frame>
                                    </SwipeView>
                            </ViewCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>

Best Answer

Answers

  • YelinzhYelinzh Member, Xamarin Team Xamurai
    edited May 2020

    @ifoxbr I created a basic demo to test the code and it works fine. Did you add other settings to the listView?

  • ifoxbrifoxbr Member ✭✭

    Tks Jarvan
    No,... the code is the same as above, except 'bindings' and I´m running on physical device. On android emulator also same results. My xamarin forms version is 4.6.0.726
    If I remove "Frame" SwipeView works as expected.

Sign In or Register to comment.