forked from xamarin/Xamarin.Forms
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[iOS] Prevent multiple ListView cells from being swiped simultaneously (
xamarin#578) * disable multiple cell swipe * add sample code * refactored * convert to weakreference * remove null setting * change weakreference setting place * remove if * revert isopen changes * add instructions
- Loading branch information
1 parent
fd8f107
commit 649c57f
Showing
3 changed files
with
89 additions
and
4 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43735.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using System.Collections.Generic; | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
|
||
#if UITEST | ||
using Xamarin.UITest; | ||
using NUnit.Framework; | ||
#endif | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Bugzilla, 43735, "Multiple Swipe on ContextActions", PlatformAffected.iOS)] | ||
public class Bugzilla43735 : TestContentPage // or TestMasterDetailPage, etc ... | ||
{ | ||
protected override void Init() | ||
{ | ||
var stackLayout = new StackLayout(); | ||
|
||
var l = new Label | ||
{ | ||
Text = "Swipe multiple cells at the same time. Only one cell should show its context actions." | ||
}; | ||
stackLayout.Children.Add(l); | ||
|
||
var list = new List<int>(); | ||
for (var i = 0; i < 20; i++) | ||
list.Add(i); | ||
|
||
var listView = new ListView | ||
{ | ||
ItemsSource = list, | ||
ItemTemplate = new DataTemplate(() => | ||
{ | ||
var label = new Label(); | ||
label.SetBinding(Label.TextProperty, new Binding(".")); | ||
return new ViewCell | ||
{ | ||
View = new ContentView | ||
{ | ||
Content = label, | ||
}, | ||
ContextActions = { new MenuItem | ||
{ | ||
Text = "Action" | ||
}, | ||
new MenuItem | ||
{ | ||
Text = "Delete", | ||
IsDestructive = true | ||
} } | ||
}; | ||
}) | ||
}; | ||
stackLayout.Children.Add(listView); | ||
|
||
Content = stackLayout; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters