1

My app has a map component that I create within a Stacklayout in the XAML like this:

    <maps:Map x:Name="amap">
        <x:Arguments>
            <maps:MapSpan>
                <x:Arguments>
                    <maps:Position>
                        <x:Arguments>
                            <x:Double x:Name="Lat">48.2</x:Double>
                            <x:Double x:Name="Long">-106.6501939</x:Double>
                        </x:Arguments>
                    </maps:Position>
                    <x:Double>0.01</x:Double>
                    <x:Double>0.01</x:Double>
                </x:Arguments>
            </maps:MapSpan>
        </x:Arguments>
    </maps:Map>

I then get a location from a db search, drop a pin at that location and pan to it:

    private void MoveMap(Quarter location)
    {
        var pin = new Pin();
        pin.Position = new Position(location.Lat, location.Lon);
        pin.Label = locationEntry.Text;
        MoveMap(pin);
    }
    private void MoveMap(Pin pin)
    {
        amap.Pins.Add(pin);
        amap.MoveToRegion(new MapSpan(pin.Position, 0.1, 0.1));
    }

google map in app

So far so good, but if I click on the pin it gets better...

better google map

I'm looking for a way to get the links to Google maps on the bottom to appear right off the bat. I would also like to make the label show on the pin. I've tried calling amap.SendMapClicked(pin.Position) right after the call to MoveToRegion, but nothing happens.

And finally I would like to display the "mode selector" from Google maps, which switches between satellite and default.

Is any of this possible? Lots of googling doesn't give me much hope.

marcp
  • 1,179
  • 2
  • 15
  • 36
  • Pin has a SendMarkerClicked method - use that. – Jason Apr 10 '20 at 23:44
  • @Jason that doesn't do anything either. It returns false. I've added `pin.SendMarkerClick();`after my call to MoveToRegion in the second MoveMap function above. – marcp Apr 11 '20 at 21:09

1 Answers1

0

Try this it's working for me

    private void MoveMap(Quarter location)
    {
        var pin = new Pin
        {
            Type = PinType.Place,
            Position = new Position(location.Lat, location.Lon),
            Label = locationEntry.Text
        };
        amap.Pins.Add(item.Pins);
        amap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(pin.Position.Latitude, pin.Position.Longitude),
Distance.FromMiles(50)));

    }
Jasmin Sojitra
  • 1,090
  • 10
  • 24
  • I already have that part working. It's the subsequent `sendMapClicked` or `sendMarkerClicked` that doesn't work for me. Of course I'm only trying to trigger the click to get the links displayed on the map, so an alternate way of accomplishing that is perfectly acceptable – marcp Apr 17 '20 at 21:25
  • This code helps you? pin.InfoWindowClicked += async (s, args) => { await PinClicked((Pin)s); }; – Filipe Piletti Plucenio May 29 '20 at 02:54
  • @FilipePilettiPlucenio no. – Softlion Feb 09 '22 at 18:28