This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Core] Invoke Clicked event tapping SwipeItems #11298
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while you're at it,
OnInvoked
could be an explicit interface implementation