尝试创建我添加到地图的自定义引脚,这样我就可以获得比标准选项更多的选项,所以当我使用引脚时,我会添加更多选项。我已经开始使用某些东西,但是我无法达到我创建的字符串。
lapply(nodes, function (x) xmlSApply(x,xmlValue))
所以我以后可以使用这样的引脚:
public Pin MyCustomPinHolder
{
get { return MyCustomPinHolder; }
set {
string info1;
string info2;
;}
}
除了标签之类的功能,例如Label + Address,我也想使用我创建的字符串,但现在我找不到它们(例如下面的代码):
MyCustomPinHolder.Label = "";
MyCustomPinHolder.Address = "";
答案 0 :(得分:1)
public class MyCustomPinHolder
{
public MyCustomPinHolder() {
MapPin = new Pin();
}
public string info1 { get; set; }
public string info2 { get; set; }
public Pin MapPin { get; set; }
}
使用它:
var myPin = new MyCustomPinHolder();
myPin.info1 = "foo";
myPin.info2 = "bar";
myPin.MapPin.Label = "blah";
myPin.MapPin.Address = "blah";
myPin.MapPin.Position = new Position(lat, long);
myMap.Pins.Add(myPin.MapPin);
单击处理程序中的
public void Pin_Clicked(object sender, EventArgs e) {
Pin p = (Pin) sender;
// we need to find the custom pin holder that contains this pin
// assume pins is a List<MyCustomPinHolder> with all of your pins in it
var holder = pins.First(x => x.MapPin == p);
// pass the entire MyCustomPinHolder object to the next page
Navigation.PushModalAsync (new DetailPage(holder));
}