private void DetailedTripList_OnItemClick(object sender, ItemClickEventArgs e) { ListView list = sender as ListView; if (list == null) { return; } //Frame clicked point on the map TripLeg clickedLeg = (TripLeg)e.ClickedItem; var boundingBox = SingleMap.GetBoundingBoxWithIds(clickedLeg.TemporaryId); double bottomMargin = DirectionsFloatingPanel.IsOpen ? DirectionsFloatingPanel.ExpandedHeight + 10 : 10; SingleMap.TrySetViewBoundsAsync(boundingBox, new Thickness(10, 10, 10, bottomMargin), MapAnimationKind.Bow).DoNotAwait(); //Expand intermediate stops of clicked leg var element = list.ContainerFromItem(e.ClickedItem); var intermediatesControl = element.FindChild <TripDetailListIntermediates>("IntermediateStops"); if (intermediatesControl != null) { intermediatesControl.ToggleViewState(); } }
private void SingleMap_MapElementsChanged(object sender, EventArgs e) { if (_favoritePlace != null || (SearchBoxPlace != null && SearchBoxPlace.Type != ModelEnums.PlaceType.NameOnly)) { var boundingBox = SingleMap.GetAllMapElementsBoundingBox(); SingleMap.TrySetViewAsync(new Geopoint(boundingBox.NorthwestCorner), 13, MapAnimationKind.Default).DoNotAwait(); } if (_favoriteRoute != null) { var boundingBox = SingleMap.GetAllMapElementsBoundingBox(); SingleMap.TrySetViewBoundsAsync(boundingBox, null, MapAnimationKind.Default, true).DoNotAwait(); } }
private void SwitchToDetailedState(MessageTypes.ViewPlanDetails details) { MapWidth = this.ActualWidth; //Otherwise MapControl sets its own width, which, in rare cases, is too wide. if (TripStateGroup.CurrentState == _tripListState) { VisualStateManager.GoToState(this, _detailedTripState.Name, true); } else { VisualStateManager.GoToState(this, _detailedTripState.Name, false); } GeoboundingBox iconsBoundingBox = SingleMap.GetAllMapElementsBoundingBox(); var mapMargin = new Thickness(10, 10, 10, (this.ActualHeight * .66) + 10); SingleMap.TrySetViewBoundsAsync(iconsBoundingBox, mapMargin, MapAnimationKind.None, true).DoNotAwait(); }