-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Issue1742.cs
60 lines (52 loc) · 1.42 KB
/
Issue1742.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[NUnit.Framework.Category(Core.UITests.UITestCategories.Github5000)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 1742, "Invisible Button still fires Clicked event", PlatformAffected.WinPhone)]
public class Issue1742 : ContentPage
{
public Issue1742()
{
var listView = new ListView
{
RowHeight = 40
};
var invisibleButton = new Button
{
IsVisible = false,
Text = "INVISIBLE button"
};
var visibleButton = new Button
{
IsVisible = true,
Text = "Visible button"
};
invisibleButton.Clicked += Button_Clicked;
visibleButton.Clicked += Button_Clicked;
listView.ItemTapped += ListView_ItemTapped;
listView.ItemsSource = new string[] { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
Content = new StackLayout
{
VerticalOptions = LayoutOptions.FillAndExpand,
Children = { listView, visibleButton, invisibleButton }
};
}
void ListView_ItemTapped(object sender, ItemTappedEventArgs args)
{
DisplayAlert("Alert", "List item tapped", "OK", "Cancel");
}
void Button_Clicked(object sender, EventArgs args)
{
DisplayAlert("Alert", ((Button)sender).Text + " clicked", "OK", "Cancel");
}
}
}