forked from xamarin/Xamarin.Forms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Invoke Clicked from SwipeItems (xamarin#11298)
Co-authored-by: Samantha Houts <samhouts@users.noreply.github.com> fixes xamarin#11286
- Loading branch information
1 parent
7e978f9
commit 5c88172
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
88 changes: 88 additions & 0 deletions
88
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue11286.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,88 @@ | ||
using Xamarin.Forms.Internals; | ||
using Xamarin.Forms.CustomAttributes; | ||
using System.Collections.Generic; | ||
|
||
#if UITEST | ||
using Xamarin.UITest; | ||
using NUnit.Framework; | ||
using Xamarin.Forms.Core.UITests; | ||
#endif | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
#if UITEST | ||
[Category(UITestCategories.SwipeView)] | ||
#endif | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 11286, | ||
"[Bug] SwipeItem clicked event not working", | ||
PlatformAffected.Android)] | ||
public class Issue11286 : TestContentPage | ||
{ | ||
public Issue11286() | ||
{ | ||
#if APP | ||
Device.SetFlags(new List<string> { ExperimentalFlags.SwipeViewExperimental }); | ||
#endif | ||
} | ||
|
||
protected override void Init() | ||
{ | ||
Title = "Issue 11286"; | ||
|
||
var layout = new StackLayout(); | ||
|
||
var instructions = new Label | ||
{ | ||
Padding = 12, | ||
BackgroundColor = Color.Black, | ||
TextColor = Color.White, | ||
Text = "Swipe to the right and tap the SwipeItem. If the text below the SwipeView is updated, the test has passed." | ||
}; | ||
|
||
var swipeView = new SwipeView(); | ||
|
||
var swipeItem = new SwipeItem | ||
{ | ||
BackgroundColor = Color.Red, | ||
Text = "Text" | ||
}; | ||
|
||
swipeView.LeftItems = new SwipeItems | ||
{ | ||
swipeItem | ||
}; | ||
|
||
var swipeContent = new Grid | ||
{ | ||
HeightRequest = 80, | ||
BackgroundColor = Color.LightGray | ||
}; | ||
|
||
var label = new Label | ||
{ | ||
HorizontalOptions = LayoutOptions.Center, | ||
VerticalOptions = LayoutOptions.Center, | ||
Text = "Swipe to Right" | ||
}; | ||
|
||
swipeContent.Children.Add(label); | ||
|
||
swipeView.Content = swipeContent; | ||
|
||
var result = new Label(); | ||
|
||
layout.Children.Add(instructions); | ||
layout.Children.Add(swipeView); | ||
layout.Children.Add(result); | ||
|
||
Content = layout; | ||
|
||
swipeItem.Clicked += (sender, args) => | ||
{ | ||
result.TextColor = Color.Green; | ||
result.Text = "The test has passed"; | ||
}; | ||
} | ||
} | ||
} |
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