summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla40251.cs
blob: 64e9f66734c20107cf7e81a0ad0d9b57170b2486 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using System;

#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif

namespace Xamarin.Forms.Controls.Issues
{
	[Preserve(AllMembers = true)]
	[Issue(IssueTracker.Bugzilla, 40251, "Cannot style Buttons natively using UIButton.Appearance", PlatformAffected.iOS)]
	public class Bugzilla40251 : TestNavigationPage // or TestMasterDetailPage, etc ...
	{
		protected override void Init()
		{
			PushAsync(new LandingPage40251());
		}
	}

	[Preserve(AllMembers = true)]
	public class LandingPage40251 : ContentPage
	{
		public LandingPage40251()
		{
			var stackLayout = new StackLayout
			{
				Orientation = StackOrientation.Vertical,
				Spacing = 20,
				VerticalOptions = LayoutOptions.Center
			};

			var label0 = new Label
			{
				Text = "Each label below will update UIButton.Appearance proxy. When you remove the page from the stack, the original value will be set again.",
				HorizontalTextAlignment = TextAlignment.Center
			};
			stackLayout.Children.Add(label0);

			var label1 = new Label
			{
				Text = "TitleColor",
				HorizontalTextAlignment = TextAlignment.Center
			};
			var t1 = new TapGestureRecognizer();
			t1.Tapped += T_Tapped;
			label1.GestureRecognizers.Add(t1);
			stackLayout.Children.Add(label1);

			var label2 = new Label
			{
				Text = "TitleShadowColor",
				HorizontalTextAlignment = TextAlignment.Center
			};
			var t2 = new TapGestureRecognizer();
			t2.Tapped += T_Tapped2;
			label2.GestureRecognizers.Add(t2);
			stackLayout.Children.Add(label2);

			var label3 = new Label
			{
				Text = "BackgroundImage",
				HorizontalTextAlignment = TextAlignment.Center
			};
			var t3 = new TapGestureRecognizer();
			t3.Tapped += T_Tapped3;
			label3.GestureRecognizers.Add(t3);
			stackLayout.Children.Add(label3);

			Content = stackLayout;
		}

		private async void T_Tapped(object sender, EventArgs e)
		{
			await Navigation.PushAsync(new TestPage40251("TitleColor"));
		}

		private async void T_Tapped2(object sender, EventArgs e)
		{
			await Navigation.PushAsync(new TestPage40251("TitleShadowColor"));
		}

		private async void T_Tapped3(object sender, EventArgs e)
		{
			await Navigation.PushAsync(new TestPage40251("BackgroundImage"));
		}
	}

	[Preserve(AllMembers = true)]
	public class TestPage40251 : ContentPage
	{
		public static string Arg;

		public TestPage40251(string arg)
		{
			Arg = arg;

			Content = new ContentView
			{
				Content = new Button
				{
					HorizontalOptions = LayoutOptions.Center,
					VerticalOptions = LayoutOptions.Center,
					Text = "Button",
					BackgroundColor = Color.Black,
					WidthRequest = 250,
					HeightRequest = 50
				}
			};
		}
	}
}