Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxMap.MarkerClick Event

Fires when a user clicks a map marker.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[Parameter]
public EventCallback<MapMarkerClickEventArgs> MarkerClick { get; set; }

#Event Data

The MarkerClick event's data class is MapMarkerClickEventArgs. The following properties provide information specific to this event:

Property Description
Marker Returns information about the clicked marker.

#Remarks

Use the MarkerClick event to handle clicks on markers. The event’s Marker property returns information about the clicked marker.

razor
<DxMap Provider="MapProvider.Azure"
       Zoom="18"
       Width="950px"
       Height="400px"
       MarkerClick="OnMapMarkerClick" >
    <DxMapApiKeys Azure="@MapApiKeyProvider.GetAzureProviderKey()" />
    <DxMapMarkers>
        <DxMapMarker MarkerId="BusStation" IconUrl="images/bus-station-mark.png" >
            <DxMapMarkerLocation GeoPosition="51.481633,-0.008281" />
        </DxMapMarker>
        <DxMapMarker MarkerId="GiftShop" IconUrl="images/shop-mark.png">
            <DxMapMarkerLocation GeoPosition="51.480889,-0.009259" />
        </DxMapMarker>
    </DxMapMarkers>
    <DxMapRoutes>
        <DxMapRoute Color="red" Weight="9" Mode="MapRouteMode.Walking">
            <DxMapRouteLocations>
                <DxMapRouteLocation GeoPosition="51.481633,-0.008281" />
                <DxMapRouteLocation GeoPosition="51.481186,-0.009107" />
                <DxMapRouteLocation GeoPosition="51.480889,-0.009259" />
            </DxMapRouteLocations>
        </DxMapRoute>
    </DxMapRoutes>
</DxMap>
@code {
    void OnMapMarkerClick(MapMarkerClickEventArgs e) {
        switch(e.Marker.MarkerId) {
            case "BusStation":
                ShowBusStationInformation();
                break;
            case "GiftShop":
                ShowShopInformation();
                break;
        }
    }
    // ...
}

Map - Icon Url

Run Demo: Map Markers

See Also