I would like the ability to show the info window pragmatically.
DETAILS
This could be useful when you want to select a pin and show it's info window without tapping on it. For example, if you have a list of items and want to go to that place on the map when that item is tapped.
// How to use of your requested feature
Map.ShowInfoWindow(pin)
PLATFORMS
[x] Android
[x] iOS
[x] UWP
Progress
I have already created a custom renderer that does exactly what I need, but it's not very clean as I don't have access to the internal classes. For example on UWP:
public class CustomMapRenderer : MapRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Map> e)
{
if (e.OldElement is CustomMap map)
{
map.ShowLabelRequest -= Map_ShowLabelRequest;
}
if (e.NewElement is CustomMap map1)
{
map1.ShowLabelRequest += Map_ShowLabelRequest;
}
base.OnElementChanged(e);
}
StackPanel previous;
private void Map_ShowLabelRequest(object sender, Xamarin.Forms.GoogleMaps.Pin e)
{
if (previous != null)
{
previous.Visibility = Visibility.Collapsed;
}
var item = e.NativeObject as ContentControl;
var details = item.GetType().GetProperty("DetailsView").GetValue(item) as StackPanel;
details.Visibility = Visibility.Visible;
previous = details;
}
}
SUMMARY
I would like the ability to show the info window pragmatically.
DETAILS
This could be useful when you want to select a pin and show it's info window without tapping on it. For example, if you have a list of items and want to go to that place on the map when that item is tapped.
PLATFORMS
Progress
I have already created a custom renderer that does exactly what I need, but it's not very clean as I don't have access to the internal classes. For example on UWP: