Map OnitemSelect registration method cannot be triggered

Hi 

When I click on the area block of the map, the OnitemSelect registration method cannot be triggered. I referred to the example and did not find any differences. Please help analyze and review.


Attachment: MapsSample_3337480f.rar

3 Replies

IR Indumathi Ravi Syncfusion Team March 5, 2024 12:37 PM UTC

Hi Tyrone,


When we analyzed the provided code snippet, we noticed that the selection support was not enabled in the Maps. The “OnItemSelect” event will be triggered only when the selection support is enabled, and the layer shape is selected in this instance. So, the event is not working properly. However, after enabling the selection support, the event is working as expected. Please find the code snippet for the same below.


Code Snippet:

<SfMaps>

    <MapsEvents OnClick="@OnClickEvent" OnItemSelect="@OnItemSelectEvent"></MapsEvents>

    //..

    //..

    <MapsLayers>

        <MapsLayer ShapeData='@data'

                   ShapePropertyPath='new string[] {"Name"}'

                   DataSource="MapDataDetails"

                   ShapeDataPath="Name" TValue="MapData">

            //..

            <MapsLayerSelectionSettings Enable="true" Fill="green">

                <MapsLayerSelectionBorder Color="White" Width="2"></MapsLayerSelectionBorder>

            </MapsLayerSelectionSettings>

        </MapsLayer>

    </MapsLayers>

</SfMaps>

 

@code {

   public void OnItemSelectEvent(Syncfusion.Blazor.Maps.SelectionEventArgs args)

   {

    var DataArgs = args;

   }

}


Please find the modified sample that demonstrates the same at the below link.

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Maps1357222559

Video: https://www.syncfusion.com/downloads/support/directtrac/general/ze/maps-event-1283302932


Please let us know if you need any further assistance.



TY Tyrone March 5, 2024 01:34 PM UTC

Great response.

Thanks



IR Indumathi Ravi Syncfusion Team March 6, 2024 01:06 PM UTC

Hi Tyrone,


Thank you for the update.


Please get back to us if you need any further assistance.


Loader.
Up arrow icon