/
TrailPage.cs
69 lines (60 loc) · 2.27 KB
/
TrailPage.cs
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
using App1.Models;
using Xamarin.Forms;
namespace App1.Views
{
class TrailPage : ContentPage
{
private readonly int pageDefaultFontSize = 18;
private readonly Color pageDefaultFontColor = Color.Black;
public TrailPage(string id)
{
var trail = DbQueryAsync.GetTrailById(id);
StackLayout stackContainer = GenerateStackContainer(trail);
Content = new ScrollView { Content = stackContainer };
}
private StackLayout GenerateStackContainer(Trails trail)
{
StackLayout stackContainer = new StackLayout
{
Orientation = StackOrientation.Vertical,
BackgroundColor = Color.White,
//Padding = new Thickness(10, 10)
};
Label mainLabel = GenericsContent.GenerateMainLabel();
stackContainer.Children.Add(mainLabel);
Label rateLabel = new Label
{
Text = $"Rate {trail.Rate.ToString("N1")}",
FontSize = pageDefaultFontSize,
TextColor = pageDefaultFontColor
};
stackContainer.Children.Add(rateLabel);
Label trailName = new Label
{
Text = trail.Name,
FontSize = 22,
FontAttributes = FontAttributes.Bold,
TextColor = pageDefaultFontColor
};
stackContainer.Children.Add(trailName);
Label locationLabel = new Label
{
Text = $"{trail.Region} {trail.Country}",
FontSize = pageDefaultFontSize,
TextColor = pageDefaultFontColor
};
stackContainer.Children.Add(locationLabel);
//var map = new Map(
//MapSpan.FromCenterAndRadius(
// new Position(37, -122), Distance.FromMiles(0.3)))
//{
// IsShowingUser = true,
// HeightRequest = 100,
// WidthRequest = 960,
// VerticalOptions = LayoutOptions.FillAndExpand
//};
//stackContainer.Children.Add(map);
return stackContainer;
}
}
}