question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Swipe does not work for all items in the listview. ConverterParameter has something to do with that

See original GitHub issue

Hello, this is an incredible library.

While trying it out in my project I’ve found out that the converterParameter on widthRequest for the [context].View has a bit impact on the functionality of the swiping.

I’ve copied the code from your MenuFitWidthConverter.cs class in my project because it was throwing an error.

I am using Xamarin.Forms 3.4.0.1039999

I’ve copied your example from https://github.com/AndreiMisiukevich/ContextMenu/blob/master/ContextMenuSample/ContextMenuSample/Pages/MoveToDeletePage.xaml but i can see that some of my items in my listview do not swipe. The ones that are “stuck” it appears that they have a smaller height than the rest that are working.

Thank you in advance.

Please see gif attached and my code: swipe_to_remove

<ListView ItemsSource="{Binding Notifications}"
        HorizontalOptions="FillAndExpand"
        VerticalOptions="FillAndExpand"
        HasUnevenRows="True"
        SelectionMode="None"
        SeparatorVisibility="None"
        IsPullToRefreshEnabled="False"
        RefreshCommand="{Binding RefreshNotificationsCommand}"
        IsRefreshing="{Binding IsLoading}"
        x:Name="NotificationItemsView"
   >
   <ListView.ItemTemplate>
      <DataTemplate>
            <!--Swipe to delete-->
            <context:SwipeActionContextHolder MovedCommand="{Binding MarkAsReadCommand}">
               <context:SwipeActionContextMenuView ForceCloseCommand="{Binding ForceCloseCommand}">
                  <context:SwipeActionContextMenuView.View>
                     <Frame BackgroundColor="#512DA8"
                           Margin="15,5"
                           Padding="20"
                           WidthRequest="{Binding Source={x:Reference NotificationItemsView}, 
                                       Path=Width, 
                                       Converter={StaticResource MenuFitWidthConverter}, 
                                       ConverterParameter='70'}"
                           CornerRadius="10"
                        >
                        <StackLayout Orientation="Horizontal" 
                                  HorizontalOptions="FillAndExpand"
                                  Spacing="10">
                           <Label Text="Text text , blah blah" />
                        </StackLayout>
                     </Frame>
                  </context:SwipeActionContextMenuView.View>

                  <context:SwipeActionContextMenuView.ContextTemplate>
                     <DataTemplate>
                        <Frame Margin="15, 5"
                              IsClippedToBounds="true"
                              CornerRadius="10"
                              BackgroundColor="Red"
                           >
                           <StackLayout Padding="10, 0"
                                     Margin="0, 5"
                              >
                              <Label Text="Dismiss"
                                    TextColor="White"
                                    FontAttributes="Bold"
                                    VerticalOptions="CenterAndExpand"
                                    HorizontalOptions="EndAndExpand"
                              />
                           </StackLayout>
                        </Frame>
                     </DataTemplate>
                  </context:SwipeActionContextMenuView.ContextTemplate>
               </context:SwipeActionContextMenuView>
            </context:SwipeActionContextHolder>
      </DataTemplate>
   </ListView.ItemTemplate>
</ListView>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pantelisGeo90commented, Nov 26, 2019

@AndreiMisiukevich Thanks for your response.

Unfortunately I can’t use CollectionView because i am using Xamarin.Forms 3.4 and i think the collectionView was introduced in version 4. (i can’t update because the behaviour of my app breaks as soon as i update to a higher version of xamarin.forms, something to do with the carousel, i’ll either have to use a different carousel or stay at this version) I’ll stick with the RepeaterView for now (Xamarin.CustomControls.RepeaterView) and update this comment when i’ll have some more details regarding this. Thanks 👍

0reactions
AndreiMisiukevichcommented, Nov 26, 2019

closing for now

Read more comments on GitHub >

github_iconTop Results From Across the Web

Xamarin Forms - Listview Swipe Gestures not working on ...
I want to be able to swipe over the entire listview (not individual items in the listview) to perform a certain action. I...
Read more >
[Bug] ListView inside SwipeView swipe not working in ...
To resolve this go with collection view inside swipe items. incase the data template have data trigger, convert those data triggers to ...
Read more >
Binding doesn't work when passed to ConverterParameter
Hello, trying to figure out why my binding doesn't work when I want to pass value to IValueConverter. For example:
Read more >
ItemSelected event is not firing when a SwipeView is inside ...
But when I wrapped it inside a ContentView, swipe actions are working but ListView's ItemSelected event is not firing.
Read more >
How to work with multilevel nested ListView in Xamarin. ...
You can load a multi-level nested ListView in Xamarin.Forms SfListView. XAML. Define First and Second level ListView with AutoFitMode as DynamicHeight to re ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found