summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue1613.cs
blob: 1bc905a50a2a88c4ac72079f80585d2a3657c418 (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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using Xamarin.Forms.Maps;

namespace Xamarin.Forms.Controls.TestCasesPages
{
	[Preserve (AllMembers=true)]
	[Issue (IssueTracker.Github, 1613, "Map.GetSizeRequest always returns map's current size", PlatformAffected.Android | PlatformAffected.iOS)]
	public class Issue1613 : ContentPage
	{
		public Issue1613 ()
		{
			Build ();
		}

		async void Build ()
		{
			var image = new Image {
				Source = "http://www.califliving.com/title24-energy/images/sanfrancisco.jpg",
				Aspect = Aspect.AspectFill,
				Opacity = 0.5,
			};

			var name = new Label {
				Text = "Foo",
#pragma warning disable 618
				XAlign = TextAlignment.Center,
#pragma warning restore 618

#pragma warning disable 618
				YAlign = TextAlignment.Center,
#pragma warning restore 618

#pragma warning disable 618
				Font = Font.SystemFontOfSize(30, FontAttributes.Bold),
#pragma warning restore 618
				TextColor = Color.White,
			};

			var nameView = new AbsoluteLayout {
				HeightRequest = 170,
				BackgroundColor = Color.Black,
				Children = { 
					{image, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All},  
					{name, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All} 
				},
			};
				
			var addressLabel = new Label {
				Text = "Loading address…",
#pragma warning disable 618
				XAlign = TextAlignment.Center,
#pragma warning restore 618

#pragma warning disable 618
				YAlign = TextAlignment.Center,
#pragma warning restore 618
			};
										
			var map = new Map {
				VerticalOptions = LayoutOptions.FillAndExpand,
			};

			Content = new StackLayout {
				Children = { nameView, addressLabel, map },
			};

			await Task.Delay (1000);
			addressLabel.Text = "Updated with new\nmultiline\nlabel";
		}
	}
}