forked from xamarin/Xamarin.Forms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bugzilla29017.cs
74 lines (61 loc) · 1.51 KB
/
Bugzilla29017.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
70
71
72
73
74
using System;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Maps;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls
{
[Issue (IssueTracker.Bugzilla, 29017, "Pin clicked does not work on iOS maps")]
public class Issue29017 : TestContentPage // or TestMasterDetailPage, etc ...
{
Label _lbl;
protected override void Init ()
{
var map = new Map {
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand
};
_lbl = new Label {
Text = "Not Clicked"
};
Content = new StackLayout {
Children = {
new Button {
Text = "Add pins",
Command = new Command (() => {
foreach (var pin in map.Pins) {
pin.Clicked -= PinClicked;
}
map.Pins.Clear ();
for (int i = 0; i < 100; i++) {
var rnd = new Random ();
var lat = rnd.NextDouble () / 10;
var lng = rnd.NextDouble () / 10;
if (i % 2 == 0) {
lat = -lat;
lng = -lng;
}
var pin = new Pin {
Address = "address",
Label = "label",
Type = PinType.Place,
Position = new Position (map.VisibleRegion.Center.Latitude + lat, map.VisibleRegion.Center.Longitude + lng)
};
pin.Clicked += PinClicked;
map.Pins.Add (pin);
}
})
},
_lbl,
map
}
};
}
void PinClicked (object sender, EventArgs e)
{
_lbl.Text = "Click " + DateTime.Now.ToLocalTime ();
}
}
}