Question

on windows phone 8, i have a page that contains a map on double click the zoom level increases. i need on click to place a landmark and get the coordinates of that landmark.

<Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>
            <StackPanel Name="mapContainer" Grid.Row="0" >
                <maps:Map Name="Mymap" VerticalAlignment="Top" Height="{Binding ElementName=mapContainer, Path=ActualHeight}" Width="{Binding ElementName=ContentPanel,Path=ActualWidth}" LandmarksEnabled="True" MouseLeftButtonDown="Mymap_MouseLeftButtonDown"/>
            </StackPanel>
Was it helpful?

Solution

Add a tap handler to the map.

And have the handler as follows ::

    private void MapControl_Tap(object sender, System.Windows.Input.GestureEventArgs e)
    {
        GeoCoordinate geocoordinate = this.MapControl.ConvertViewportPointToGeoCoordinate(e.GetPosition(this.MapControl));
    }

You will have the map coordinates in the geocoordinate object. Hope i got the question right and the solution helps.

OTHER TIPS

You can convert the clicked pixel location to a coordinate with Map.ConvertViewportPointToGeoCoordinate Method

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top