private void InitMap() { foreach (var sensor in sensors.List) { PushpinModel pin = new PushpinModel { //Location is the field of Pushpin class Location = new Location(sensor.Latitude, sensor.Longitude), Latitude = sensor.Latitude, Longtitude = sensor.Longitude, Title = sensor.Name.ToString(), Type = sensor.GetType().Name, Description = sensor.Description }; ToolTipService.SetToolTip(pin, new ToolTip() { DataContext = pin, Style = Application.Current.Resources["CustomInfoboxStyle"] as Style }); Pushpins.Add(pin); //MapWithMarkers.Children.Add(pin); } }
private void InitMap() { MapForSensorList = new Map { ZoomLevel = 12, Mode = new AerialMode(true), CredentialsProvider = new ApplicationIdCredentialsProvider("Arlj7m-YopkSpqjw8gdI2PHqnd8tulYdY91G_h8qZ42jmUOPjjqFRnO7iMpk9TuS") }; PushpinModel pin = new PushpinModel { //Location is the field of Pushpin class Location = new Location(Selected.Latitude, Selected.Longitude), Latitude = Selected.Latitude, Longtitude = Selected.Longitude, Title = Selected.Name.ToString(), Type = Selected.GetType().Name, Description = Selected.Description }; ToolTipService.SetToolTip(pin, new ToolTip() { DataContext = pin, Style = Application.Current.Resources["CustomInfoboxStyle"] as Style }); //Infobox logic //pin.MouseLeftButtonDown += PinClicked; MapForSensorList.Children.Add(pin); }