Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[iOS] Fix issue with SwipeView and grouped ListView with scroll #11055

Merged
merged 3 commits into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?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="Xamarin.Forms.Controls.Issues.Issue10908"
Title="Issue 10908">
<ContentPage.Content>
<ListView
x:Name ="lstView"
IsGroupingEnabled="true"
HasUnevenRows="True"
SeparatorVisibility="None"
GroupDisplayBinding="{Binding LongName}"
GroupShortNameBinding="{Binding ShortName}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<SwipeView>
<SwipeView.LeftItems>
<SwipeItem
BackgroundColor="Red"
IconImageSource="icon.png"
Text="Delete"/>
</SwipeView.LeftItems>
<StackLayout
HeightRequest="60">
<Label Text="{Binding Name}" />
<Label Text="{Binding Comment}" />
</StackLayout>
</SwipeView>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ContentPage.Content>
</ContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
using System.Collections.ObjectModel;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 10908, "[Bug] [iOS]SwipeView not working on Grouped ListView", PlatformAffected.iOS)]
public partial class Issue10908 : ContentPage
{
public Issue10908()
{
#if APP
InitializeComponent ();

Grouped = new ObservableCollection<GroupedIssue10908Model>();

var veggieGroup = new GroupedIssue10908Model() { LongName = "vegetables", ShortName = "v" };
var fruitGroup = new GroupedIssue10908Model() { LongName = "fruit", ShortName = "f" };
var veggie1Group = new GroupedIssue10908Model() { LongName = "vegetables1", ShortName = "v1" };
var fruit1Group = new GroupedIssue10908Model() { LongName = "fruit1", ShortName = "f1" };
var veggie2Group = new GroupedIssue10908Model() { LongName = "vegetables2", ShortName = "v2" };
var fruit2Group = new GroupedIssue10908Model() { LongName = "fruit2", ShortName = "f2" };
veggieGroup.Add(new Issue10908Model() { Name = "celery", IsReallyAVeggie = true, Comment = "try ants on a log" });
veggieGroup.Add(new Issue10908Model() { Name = "tomato", IsReallyAVeggie = false, Comment = "pairs well with basil" });
veggieGroup.Add(new Issue10908Model() { Name = "zucchini", IsReallyAVeggie = true, Comment = "zucchini bread > bannana bread" });
veggieGroup.Add(new Issue10908Model() { Name = "peas", IsReallyAVeggie = true, Comment = "like peas in a pod" });
fruitGroup.Add(new Issue10908Model() { Name = "banana", IsReallyAVeggie = false, Comment = "available in chip form factor" });
fruitGroup.Add(new Issue10908Model() { Name = "strawberry", IsReallyAVeggie = false, Comment = "spring plant" });
fruitGroup.Add(new Issue10908Model() { Name = "cherry", IsReallyAVeggie = false, Comment = "topper for icecream" });

veggie1Group.Add(new Issue10908Model() { Name = "celery", IsReallyAVeggie = true, Comment = "try ants on a log" });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gross

veggie1Group.Add(new Issue10908Model() { Name = "tomato", IsReallyAVeggie = false, Comment = "pairs well with basil" });
veggie1Group.Add(new Issue10908Model() { Name = "zucchini", IsReallyAVeggie = true, Comment = "zucchini bread > bannana bread" });
veggie1Group.Add(new Issue10908Model() { Name = "peas", IsReallyAVeggie = true, Comment = "like peas in a pod" });
fruit1Group.Add(new Issue10908Model() { Name = "banana", IsReallyAVeggie = false, Comment = "available in chip form factor" });
fruit1Group.Add(new Issue10908Model() { Name = "strawberry", IsReallyAVeggie = false, Comment = "spring plant" });
fruit1Group.Add(new Issue10908Model() { Name = "cherry", IsReallyAVeggie = false, Comment = "topper for icecream" });

veggie2Group.Add(new Issue10908Model() { Name = "celery", IsReallyAVeggie = true, Comment = "try ants on a log" });
veggie2Group.Add(new Issue10908Model() { Name = "tomato", IsReallyAVeggie = false, Comment = "pairs well with basil" });
veggie2Group.Add(new Issue10908Model() { Name = "zucchini", IsReallyAVeggie = true, Comment = "zucchini bread > bannana bread" });
veggie2Group.Add(new Issue10908Model() { Name = "peas", IsReallyAVeggie = true, Comment = "like peas in a pod" });
fruit2Group.Add(new Issue10908Model() { Name = "banana", IsReallyAVeggie = false, Comment = "available in chip form factor" });
fruit2Group.Add(new Issue10908Model() { Name = "strawberry", IsReallyAVeggie = false, Comment = "spring plant" });
fruit2Group.Add(new Issue10908Model() { Name = "cherry", IsReallyAVeggie = false, Comment = "topper for icecream" });

Grouped.Add(veggieGroup);
Grouped.Add(fruitGroup);
Grouped.Add(veggie1Group);
Grouped.Add(fruit1Group);
Grouped.Add(veggie2Group);
Grouped.Add(fruit2Group);

lstView.ItemsSource = Grouped;
#endif
}

ObservableCollection<GroupedIssue10908Model> Grouped { get; set; }
}

[Preserve(AllMembers = true)]
public class Issue10908Model
{
public string Name { get; set; }
public string Comment { get; set; }
public bool IsReallyAVeggie { get; set; }
public string Image { get; set; }
}

[Preserve(AllMembers = true)]
public class GroupedIssue10908Model : ObservableCollection<Issue10908Model>
{
public string LongName { get; set; }
public string ShortName { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,7 @@
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Issue11031.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue10940.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue10908.xaml.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Bugzilla22229.xaml">
Expand Down Expand Up @@ -1644,6 +1645,9 @@
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue9555.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue10908.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Bugzilla27417Xaml.xaml">
Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Forms.Platform.iOS/Renderers/SwipeViewRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ void HandlePan(UIPanGestureRecognizer panGestureRecognizer)
{
if (panGestureRecognizer != null)
{
var point = panGestureRecognizer.LocationInView(Control);
CGPoint point = panGestureRecognizer.LocationInView(this);
var navigationController = GetUINavigationController(GetViewController());

switch (panGestureRecognizer.State)
Expand Down