summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue1593.cs
blob: 238ab936aa2353b8a8b072108c29115ee61094a6 (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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
using Xamarin.Forms.CustomAttributes;

namespace Xamarin.Forms.Controls
{
	[Preserve (AllMembers=true)]
	[Issue (IssueTracker.Github, 1593, "Android reports zero minimum size for almost all controls", PlatformAffected.Android)]
	public class Issue1593 : ContentPage
	{
		public Issue1593 ()
		{
			var title = new Label {
				Text = "Select League",
				Font = Font.SystemFontOfSize (NamedSize.Large),
				TextColor = Color.White
			};

			# region Season Filter

			var seasonLabel = new Label {
				Text = "Season",
				Font = Font.SystemFontOfSize (NamedSize.Small),
				TextColor = Color.White
			};

			var seasonPicker = new Picker {
				WidthRequest = 140,
				Title = "Season",
				Items = { "Test 1", "Test 2"}
			};

			var seasonPanel = new StackLayout {
				Children = {
					seasonLabel,
					seasonPicker
				}
			};

			#endregion

			# region Sport Filter

			var sportLabel = new Label {
				Text = "Sport",
				Font = Font.SystemFontOfSize (NamedSize.Small),
				TextColor = Color.White
			};

			var sportPicker = new Picker {
				WidthRequest = 140,
				Title = "Sport",
				Items = { "Test 1", "Test 2"}
			};

			var sportPanel = new StackLayout {
				Children = {
					sportLabel,
					sportPicker
				}
			};

			#endregion

			var filtersPanel = new StackLayout {
				Padding = new Thickness (0, 10, 0, 0),
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.Fill,
				Children = {
					seasonPanel,
					sportPanel
				}
			};

			var leagues = new ListView {
				MinimumHeightRequest = 100,
				ItemsSource = new [] {
					"Test 1",
					"Test 2",
					"Test 3",
					"Test 4",
					"Test 5",
					"Test 6",
					"Test 7",
					"Test 8",
					"Test 9",
					"Test 10",
					"Test 11",
					"Test 12",
					"Test 13",
					"Test 14",
					"Test 15",
				},
				BackgroundColor = Color.Gray,
				ItemTemplate = new DataTemplate (() => {
					var leagueName = new Label {
						Font =
							Font.SystemFontOfSize (NamedSize.Large),
						BackgroundColor = Color.Transparent,
						TextColor = Color.White,
						VerticalOptions = LayoutOptions.CenterAndExpand,
						LineBreakMode = LineBreakMode.WordWrap
					};
					leagueName.SetBinding (Label.TextProperty, ".");

					var row = new StackLayout {
						Padding = new Thickness (5, 0, 5, 0),
						BackgroundColor = Color.Transparent,
						Orientation = StackOrientation.Horizontal,
						VerticalOptions = LayoutOptions.CenterAndExpand,
						Children = {
							leagueName
						}
					};

					return new ViewCell {
						View = row
					};
				})
			};

			var activityIndicator = new ActivityIndicator {
				VerticalOptions =
					LayoutOptions.CenterAndExpand,
					IsVisible = false
			};

			var titlePanel = new StackLayout {
				Orientation = StackOrientation.Horizontal,
				Spacing = 50,
				Children = {
					title,
					activityIndicator
				}
			};

			var standingsButton = new Button {
				Text = "Standings",
				HorizontalOptions = LayoutOptions.CenterAndExpand
			};

			var scheduleButton = new Button {
				Text = "Schedule",
				HorizontalOptions = LayoutOptions.CenterAndExpand
			};

			var buttonPanel = new StackLayout {
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
				Children = {
					standingsButton,
					scheduleButton
				}
			};

			Content = new StackLayout {
				Padding = 20,
				Children = {
					titlePanel,
					filtersPanel,
					leagues,
					buttonPanel
				}
			};
		}
	}
}