Using a Listview with viewcell contextaction does not work on ios

I have a listview with contextactions, and on ios the side swiping stops working if you navigate away from the listview without closing the contextactions first i.e. swiping back to the right.

This only happens when running on the device, and not in the simulator.

I'm wondering if this is a bug, and if so I should file it?

Answers

  • DhilluDhillu INMember ✭✭✭

    It is working fine with me, I have added two contextmenu items on my list item.
    On selcetion of any menuitem, navigating to another page. Context actions working fine after coming back to listview screen.
    Tested on device.

        <ListView HasUnevenRows="True" ItemsSource="{Binding Items}" SeparatorColor="White" SelectedItem="{Binding SelectedEquipment}">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <ViewCell.ContextActions>
                                <MenuItem Command="{Binding Path=BindingContext.Navigate,Source={x:Reference Name=Root}}}" CommandParameter="{Binding .}" Text="More" />
                                <MenuItem Command="{Binding Path=BindingContext.Navigate,Source={x:Reference Name=Root}}}" CommandParameter="{Binding .}" Text="Delete" IsDestructive="True" />
                            </ViewCell.ContextActions>
                            <ViewCell.View>
                                    <StackLayout >
                                        <Label Text="{Binding Title}" FontSize="Large" TextColor="White"></Label>
                                        <Label Text="{Binding Description}" FontSize="Default" TextColor="White"></Label>
                                    </StackLayout>                            
                            </ViewCell.View>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
    

    This is my XAML code.

  • michaelwarnesmichaelwarnes USMember ✭✭

    how do you handle the click events for them?

  • DhilluDhillu INMember ✭✭✭

    I'm using MVVM, so binding Commands from my viewmodel.

  • michaelwarnesmichaelwarnes USMember ✭✭

    would it be possible to see your code behind, I don't understand the navigation you have applied to the contextactions

  • rio_riyario_riya INMember ✭✭

    @Dhillu have you try this scenario, swipe one cell in the list and navigate a page like clicking back, then again enter that page try to swipe.

Sign In or Register to comment.