How to dynamically add a marker to Blazor Maps?

Answer:

We can add marker dynamically in maps by using “load” or “loaded” events in blazor maps.

<EjsMaps ID="map" Height="100%" Width="100%">

<MapsEvents Load="add">MapsEvents>

<MapsLayers>

<MapsLayer ShapeData='@MapShapeData'>

<MapsMarkerSettings>

// add your additional code here

MapsMarkerSettings>

<MapsShapeSettings ColorValuePath="color">MapsShapeSettings>

MapsLayer>

MapsLayers>

EjsMaps>

@code {

EjsMaps maps;

// add your additional code here

public void add()

{

this.MarkerDataSource.Add(new MarkerData { latitude = 45.240416, longitude = -100.310779, name = "South Dakota" });

}

}


Find the sample for dynamically add a marker to Blazor Maps from here.


Loader.
Up arrow icon