我有一個圖釘集羣,我添加了foreach中所有圖釘的點擊事件。現在我需要找出哪個圖釘點擊,以便相應地採取行動。以下是我的示例代碼。圖釘點擊事件
private void setpins()
{
Pushpin pin = null;
lstpin.Add(new clsPushpin() { stores = "chennai", _loc= new locations() { lat = 13.04, longd = 80.17 } });
lstpin.Add(new clsPushpin() { stores = "Karur", _loc = new locations() { lat = 10.58, longd = 78.07 } });
lstpin.Add(new clsPushpin() { stores = "coimbatore", _loc = new locations() { lat = 11.00, longd = 77.00 } });
foreach (clsPushpin cls in lstpin)
{
pin = new Pushpin();
GeoCoordinate geo = new GeoCoordinate(cls._loc.lat, cls._loc.longd);
pin.Location = geo;
pin.Background = new SolidColorBrush(new Color() { A = 255, R = 0, G = 100, B = 120 });
pin.Foreground = new SolidColorBrush(Colors.White);
mymap.Children.Add(pin);
pin.MouseLeftButtonUp += new MouseButtonEventHandler(pushpintap);
}
mymap.Center = pin.Location;
mymap.SetView(pin.Location, 5.0);
}
private void pushpintap(object sender, MouseButtonEventArgs e)
{
//Messagebox are what ever
MessageBox.Show("My lat long is:"+lat,+long);
}
通過上面的代碼片段,保存了最後一個圖釘的值。但我想找到確切的針腳,選擇通知/彈出順從。 Thx提前。