private void References_OnChecked(object sender, RoutedEventArgs e) { //TODO: var item = (CheckBox)sender; if (item.Content.Equals("Estaciones")) { foreach (var child in MapExtensions.GetChildren(MiMapa).OfType <Pushpin>().Where(x => x.Content != null)) { child.Visibility = item.IsChecked != null && item.IsChecked.Value ? Visibility.Visible : Visibility.Collapsed; } } else { //foreach (var child in MapExtensions.GetChildren(MiMapa).OfType<MapPolyline>()) //{ // child..Visibility = item.IsChecked != null && item.IsChecked.Value ? Visibility.Visible : Visibility.Collapsed; //} } }
void MostrarLugares() { //Limpio el mapa, tomo lugares de la tabla local y los agrego al mapa _puntosLayer.Clear(); ReferencesListBox.ItemsSource = new List <MapReference> { new MapReference { Id = 1, Nombre = "Ciclovias", Checked = true }, new MapReference { Id = 2, Nombre = "Estaciones", Checked = false }, //new MapReference { Id = 3, Nombre = "Estacionamientos", Checked = false}, }; RenderBikeRoads(); var query = from miLugar in BicicletaEstacionDC.Current.Estaciones orderby miLugar.Id select miLugar; Estaciones = new ObservableCollection <BicicletaEstacionTable>(query.ToList()); foreach (var ml in Estaciones) { Pushpin nuevoLugar = new Pushpin { Content = ml.Nombre, GeoCoordinate = new GeoCoordinate(ml.Latitud, ml.Longitud), Visibility = Visibility.Collapsed, }; nuevoLugar.MouseLeftButtonUp += NuevoLugar_MouseLeftPuttonUp; MapExtensions.GetChildren(MiMapa).Add(nuevoLugar); } MiMapa.SetView(MiMapa.CreateBoundingRectangle()); //Si uso localizacion, agrego mi ubicación ActualizarUbicacion(App.Configuration.IsLocationEnabled ? App.Configuration.Ubicacion : null); }