summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues
diff options
context:
space:
mode:
authorRui Marinho <me@ruimarinho.net>2016-04-05 08:46:22 +0100
committerJason Smith <jason.smith@xamarin.com>2016-04-05 00:46:22 -0700
commit244ee01cfa3405c01746d9419e9955e07ae9df2e (patch)
tree0dd59f00c19090437a962fc31c58bc40dd2fe8d9 /Xamarin.Forms.Controls.Issues
parenta6964ab96f139aa8c6c1eea9b62dfebb6962c11c (diff)
downloadxamarin-forms-244ee01cfa3405c01746d9419e9955e07ae9df2e.tar.gz
xamarin-forms-244ee01cfa3405c01746d9419e9955e07ae9df2e.tar.bz2
xamarin-forms-244ee01cfa3405c01746d9419e9955e07ae9df2e.zip
[iOS] Fix WeakNotifyCollectionChanged on CarouselView
Make some changes on WeakNotifyCollectionChanged to make it work ok in IOS, following the ListProxy approach.
Diffstat (limited to 'Xamarin.Forms.Controls.Issues')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39499.cs64
1 files changed, 50 insertions, 14 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39499.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39499.cs
index 1597ba86..16c033dc 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39499.cs
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39499.cs
@@ -30,6 +30,8 @@ namespace Xamarin.Forms.Controls
}
public int Id => id;
+
+ public string Text => $"Item {Id}";
}
[Preserve(AllMembers = true)]
@@ -38,13 +40,13 @@ namespace Xamarin.Forms.Controls
public ItemView()
{
var idLabel = new Label() { StyleId = "id", TextColor = Color.White };
- idLabel.SetBinding(Label.TextProperty, nameof(Item.Id));
+ idLabel.SetBinding(Label.TextProperty, nameof(Item.Text));
var stackLayout = new StackLayout
{
Children = {
- //new Label { Text = "Target" },
- //new Label { Text = "Stack" }
+ new Label { Text = "Target" },
+ new Label { Text = "Stack" }
},
BackgroundColor = Color.Red
};
@@ -116,17 +118,38 @@ namespace Xamarin.Forms.Controls
{
Orientation = StackOrientation.Horizontal,
HorizontalOptions = LayoutOptions.FillAndExpand,
- Children = {
- CreateButton ("<<", () => carouselView.Position = 0),
- CreateButton ("<", () => { try { carouselView.Position--; } catch { } }),
- CreateButton (">", () => { try { carouselView.Position++; } catch { } }),
- CreateButton (">>", () => carouselView.Position = Items.Count - 1)
- }
+ Children =
+ {
+ CreateButton("+", () => Items.Add(new Item())),
+ CreateButton("<<", () => carouselView.Position = 0),
+ CreateButton("<", () =>
+ {
+ try
+ {
+ carouselView.Position--;
+ }
+ catch
+ {
+ }
+ }),
+ CreateButton(">", () =>
+ {
+ try
+ {
+ carouselView.Position++;
+ }
+ catch
+ {
+ }
+ }),
+ CreateButton(">>", () => carouselView.Position = Items.Count - 1)
+ }
};
Content = new StackLayout
{
- Children = {
+ Children =
+ {
carouselView,
moveBar
}
@@ -135,13 +158,26 @@ namespace Xamarin.Forms.Controls
#if UITEST
//[Test]
- public void CarouselViewTest ()
+ public void CarouselViewTest()
{
var app = RunningApp;
- app.Screenshot ("I am at Issue 1");
- app.WaitForElement (q => q.Marked ("Remove"));
+ app.WaitForElement(q => q.Marked("Item 0"));
+ app.SwipeRightToLeft();
+ app.WaitForElement(q => q.Marked("Item 1"));
+ app.Tap(c => c.Marked("<"));
+ app.WaitForElement(q => q.Marked("Item 0"));
+ }
- app.Screenshot ("I see the Label");
+ [Test]
+ public void CarouselViewTestAddItem()
+ {
+ var app = RunningApp;
+ app.WaitForElement(q => q.Marked("Hide Target Stack"));
+ app.Tap(c => c.Marked("+"));
+ app.SwipeRightToLeft();
+ app.SwipeRightToLeft();
+ app.WaitForElement(q => q.Marked("Item 2"));
+ app.Screenshot("I see the Item 2");
}
#endif
}