void pinMarker_Tap(object sender, System.Windows.Input.GestureEventArgs e) { var map = Control; var mapTile = (MapTile)Element; PinMarker pinMarker = sender as PinMarker; tapMarker = pinMarker; MapPinData data = pinMarker.DataContext as MapPinData; var centerLocation = new System.Device.Location.GeoCoordinate(Math.Round(map.Center.Latitude, 4), Math.Round(map.Center.Longitude, 4)); var pinLocation = new System.Device.Location.GeoCoordinate(Math.Round(data.Latitude, 4), Math.Round(data.Longitude, 4)); //map.Center = pinLocation; //mapTile.ShowDetailInfo(data.Id); if (centerLocation == pinLocation) { mapTile.ShowPinDetailInfo(data.Id); } else { map.ViewChanged += map_ViewChanged; map.SetView(pinLocation, map.ZoomLevel, MapAnimationKind.Linear); } }
private void UpdatePins() { var map = Control; var mapTile = (MapTile)Element; var toRemove = new List <MapLayer>(); foreach (var item in map.Layers) { if (item.Count > 0) { if (item[0].Content is PinMarker) { toRemove.Add(item); } } } foreach (var item in toRemove) { map.Layers.Remove(item); } foreach (var item in mapTile.PinList) { var pinMarker = new PinMarker(item); pinMarker.Tap += pinMarker_Tap; MapOverlay overlayPin = new MapOverlay { GeoCoordinate = new System.Device.Location.GeoCoordinate(item.Latitude, item.Longitude), PositionOrigin = new System.Windows.Point(0.5, 1.0), Content = pinMarker, }; MapLayer layerPin = new MapLayer(); layerPin.Add(overlayPin); map.Layers.Add(layerPin); } }
void pinMarker_Tap(object sender, System.Windows.Input.GestureEventArgs e) { var map = Control; var mapTile = (MapTile)Element; PinMarker pinMarker = sender as PinMarker; tapMarker = pinMarker; MapPinData data = pinMarker.DataContext as MapPinData; var centerLocation = new System.Device.Location.GeoCoordinate(Math.Round(map.Center.Latitude, 4), Math.Round(map.Center.Longitude, 4)); var pinLocation = new System.Device.Location.GeoCoordinate(Math.Round(data.Latitude, 4), Math.Round(data.Longitude, 4)); //map.Center = pinLocation; //mapTile.ShowDetailInfo(data.Id); if (centerLocation == pinLocation) mapTile.ShowPinDetailInfo(data.Id); else { map.ViewChanged += map_ViewChanged; map.SetView(pinLocation, map.ZoomLevel, MapAnimationKind.Linear); } }
private void UpdatePins() { var map = Control; var mapTile = (MapTile)Element; var toRemove = new List<MapLayer>(); foreach (var item in map.Layers) { if (item.Count > 0) if (item[0].Content is PinMarker) toRemove.Add(item); } foreach (var item in toRemove) { map.Layers.Remove(item); } foreach (var item in mapTile.PinList) { var pinMarker = new PinMarker(item); pinMarker.Tap += pinMarker_Tap; MapOverlay overlayPin = new MapOverlay { GeoCoordinate = new System.Device.Location.GeoCoordinate(item.Latitude, item.Longitude), PositionOrigin = new System.Windows.Point(0.5, 1.0), Content = pinMarker, }; MapLayer layerPin = new MapLayer(); layerPin.Add(overlayPin); map.Layers.Add(layerPin); } }