Swipe does not work for all items in the listview. ConverterParameter has something to do with that
See original GitHub issueHello, 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:
<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:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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 theRepeaterView
for now (Xamarin.CustomControls.RepeaterView) and update this comment when i’ll have some more details regarding this. Thanks 👍closing for now