Skip to content

Added support for DivIcon

Stoyan Bonchev edited this page Sep 22, 2021 · 1 revision
var mapCentre = await PositionMap.GetCenter();

var div = @"
<div style=""background-color: #00000088; border-radius: 10px; padding: 16px;width: 80px"">
    <img src=""leaf-red.png""/>
</div>
";

var divIcon = new DivIcon(new DivIconOptions() { Html = div });

var marker = new Marker(mapCentre, new MarkerOptions
{
    Keyboard = MarkerViewModel.Keyboard,
    Title = MarkerViewModel.Title,
    Alt = MarkerViewModel.Alt,
    ZIndexOffset = MarkerViewModel.ZIndexOffset,
    Opacity = MarkerViewModel.Opacity,
    RiseOnHover = MarkerViewModel.RiseOnHover,
    RiseOffset = MarkerViewModel.RiseOffset,
});

await marker.AddTo(PositionMap);
await divIcon.AddTo(marker);

Result

Clone this wiki locally