There are samples available on the github of Mapsui : PinSample.cs
The position of the callout is defined by Callout.Anchor
, you can base it on the size of the pin :
pin.Callout.Anchor = new Point(0, pin.Height * pin.Scale);
Oops just see it is not what you asked for, I am currently doing something similar by using another element on top of the map.
XAML :
<Grid VerticalOptions="FillAndExpand">
<mapsui:MapView x:Name="mapView"
VerticalOptions="FillAndExpand"
HorizontalOptions="Fill"/>
<Border
x:Name="mapContext"
IsVisible="false"
Padding="10"
Margin="5"
HorizontalOptions="Center"
VerticalOptions="Start">
<Border.StrokeShape>
<RoundRectangle CornerRadius="10" />
</Border.StrokeShape>
<Label
Text="Some content"
BackgroundColor="White"></Label>
</Border>
</Grid>
You can use the events to close / open it :
public MapTest()
{
InitializeComponent();
mapView.MapClicked += OnMapClicked;
mapView.PinClicked += OnPinClicked;
}
private void OnPinClicked(object sender, PinClickedEventArgs e)
{
mapContext.IsVisible = true;
}
private void OnMapClicked(object sender, MapClickedEventArgs e)
{
mapContext.IsVisible = false;
}
You can also change the content based on the PinClickedEventArgs.Pin
.