summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla33268.cs
blob: b3c8999b972d0198db8c046cc3887f3ed58c635f (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
136
137
138
139
140
141
142
143
144
using System.Collections.Generic;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

namespace Xamarin.Forms.Controls.Issues
{
	[Preserve (AllMembers = true)]
	[Issue (IssueTracker.Bugzilla, 33268, "Picker is broken on Windows Phone 8.1", PlatformAffected.WinRT)]
	public class Bugzilla33268 : TestTabbedPage
	{
		protected override void Init ()
		{
			Children.Add (new Bugzilla33268ListView ());
			Children.Add (new Simple ());
			Children.Add (new Bugzilla33268NoListView ());
		}
	}

	[Preserve (AllMembers = true)]
	public class Simple : TestContentPage
	{
		protected override void Init ()
		{
			Title = "Simple";

			var fiveItemPicker = new Picker { Title = "Picker With 4 Items" };
			for (var i = 1; i <= 4; i++) {
				fiveItemPicker.Items.Add ("Sample Option " + i);
			}

			Content = new StackLayout {
				BackgroundColor = Color.Green,
				VerticalOptions = LayoutOptions.Start,
				Children = {
					fiveItemPicker
				}
			};
		}
	}

	[Preserve (AllMembers = true)]
	public class Bugzilla33268NoListView : TestContentPage
	{
		protected override void Init ()
		{
			Title = "No ListView";

			var fiveItemLabel = new Label {
				Text =
					"The picker below should display four items when opened. If you open it and all four items are not visible, this test has failed."
			};

			var fiveItemPicker = new Picker { Title = "Picker With 4 Items" };
			for (var i = 1; i <= 4; i++) {
				fiveItemPicker.Items.Add ("Sample Option " + i);
			}

			var sixItemLabel = new Label {
				Text =
					"The picker below should display full screen when opened. If you open it and it's not full screen, this test has failed."
			};

			var sixItemPicker = new Picker { Title = "Picker With 6 Items" };
			for (var i = 1; i <= 6; i++) {
				sixItemPicker.Items.Add ("Sample Option " + i);
			}

			Content = new StackLayout {
				Children = {
					fiveItemLabel,
					fiveItemPicker,
					sixItemLabel,
					sixItemPicker
				}
			};
		}
	}

	[Preserve (AllMembers = true)]
	public class Bugzilla33268ListView : TestContentPage
	{
		protected override void Init ()
		{
			Title = "ListView";

			var listItems = new List<string> { "One" };

			var listView = new ListView {
				Header = "Pickers in a ListView",
				ItemTemplate = new DataTemplate (typeof(PickerCell)),
				ItemsSource = listItems
			};

			Content = new StackLayout {
				Children = {
					listView
				}
			};
		}

		[Preserve (AllMembers = true)]
		internal class PickerCell : ViewCell
		{
			public PickerCell ()
			{
				var cellWrapper = new StackLayout ();
				var stack = new StackLayout ();

				var fiveItemLabel = new Label { 
					Text =
						"The picker below should display five items when opened. If you open it and all five items are not visible, this test has failed."
				};

				var fiveItemPicker = new Picker { Title = "Picker With 5 Items" };
				for (var i = 1; i <= 5; i++) {
					fiveItemPicker.Items.Add ("Sample Option " + i);
				}

				var sixItemLabel = new Label {
					Text =
						"The picker below should display full screen when opened. If you open it and it's not full screen, this test has failed."
				};

				var sixItemPicker = new Picker { Title = "Picker With 6 Items" };
				for (var i = 1; i <= 6; i++) {
					sixItemPicker.Items.Add ("Sample Option " + i);
				}

				stack.Orientation = StackOrientation.Vertical;

				stack.Children.Add (fiveItemLabel);
				stack.Children.Add (fiveItemPicker);
				stack.Children.Add (sixItemLabel);
				stack.Children.Add (sixItemPicker);

				cellWrapper.VerticalOptions = LayoutOptions.StartAndExpand;

				cellWrapper.Children.Add (stack);

				View = cellWrapper;
			}
		}
	}
}