summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla32865.cs
blob: 27769528c484a6bbea83ccc9901423b7f08060e0 (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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
using System;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

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

// Apply the default category of "Issues" to all of the tests in this assembly
// We use this as a catch-all for tests which haven't been individually categorized
#if UITEST
[assembly: NUnit.Framework.Category("Issues")]
#endif

namespace Xamarin.Forms.Controls.Issues
{
	[Preserve(AllMembers = true)]
	[Issue(IssueTracker.Bugzilla, 32865, "On MasterDetailPage trying to change Icon of Master page doesn\'t work if another view is pushed and Image is renderer in blue", PlatformAffected.iOS)]
	public class Bugzilla32865 : TestMasterDetailPage // or TestMasterDetailPage, etc ...
	{
		public static Bugzilla32865 Mdp;

		protected override void Init()
		{
			Mdp = this;

			Master = new ContentPage {Title = "Master"};
			Detail = new NavigationPage(new DetailView32865());
		}

		public void ChangeIcon()
		{
			Master.Icon = "settings";
		}
		public void ChangeIcon2()
		{
			Master.Icon = "menuIcon";
		}
	}

	[Preserve(AllMembers = true)]
	public class DetailView32865 : ContentPage
	{
		public DetailView32865()
		{
			Title = "Page1";

			var label = new Label
			{
				Text = "Push a page and then change master icon. The icon should be changeable from any page on the navigation stack.",
				HorizontalTextAlignment = TextAlignment.Center,
				VerticalTextAlignment = TextAlignment.Center
			};

			var button = new Button()
			{
				Text = "Icon 1",
			};
			button.Clicked += Button_Clicked;
			var button2 = new Button()
			{
				Text = "Icon 2",
			};
			button2.Clicked += Button2_Clicked;
			var button3 = new Button()
			{
				Text = "Push Page",
			};
			button3.Clicked += Button3_Clicked;

			var layout = new StackLayout()
			{
				VerticalOptions = LayoutOptions.FillAndExpand,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				Children = { label, button, button2, button3 },
			};
			Content = layout;
		}
		void Button3_Clicked(object sender, EventArgs e)
		{
			Navigation.PushAsync(new DetailView232865());
		}

		void Button_Clicked(object sender, EventArgs e)
		{
			Bugzilla32865.Mdp.ChangeIcon();
		}

		void Button2_Clicked(object sender, EventArgs e)
		{
			Bugzilla32865.Mdp.ChangeIcon2();
		}
	}

	[Preserve(AllMembers = true)]
	public class DetailView232865 : ContentPage
	{
		public DetailView232865()
		{
			Title = "Page2";

			var button = new Button()
			{
				Text = "Icon 1",
			};
			button.Clicked += Button_Clicked;

			var button2 = new Button()
			{
				Text = "Icon 2",
			};
			button2.Clicked += Button2_Clicked;

			var layout = new StackLayout()
			{
				VerticalOptions = LayoutOptions.FillAndExpand,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				Children = { button, button2 },
			};

			Content = layout;
		}

		void Button_Clicked(object sender, EventArgs e)
		{
			Bugzilla32865.Mdp.ChangeIcon();
		}

		void Button2_Clicked(object sender, EventArgs e)
		{
			Bugzilla32865.Mdp.ChangeIcon2();
		}
	}
}