Example #1
0
 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();
        }