I have a map with 2 layers and it is set to show the second layer once the map is zoomed in on. It is also set up to zoom in to the map element when the element is clicked on. There are a number of other shapefiles that need to be added to the project, but I only want them to be added if that area of the map is clicked on. How do I get the name of the element that has been clicked and pass it as a variable so it can be added as a map layer? This is assuming my shapefiles would be named the same as the map element name.
Thanks.
Hi,
just wanted to confirm if your question is resolved.
-Graham
Hi sajjvino,
This was not a tutorial online, just using some logic from experience with Flash and ActionScript. At the moment its not working correctly but I will post the code when everything is functioning properly.
Hi
I also want to do the same thing that i have to load several shape file to map based on some action let say mouse click. If you have done this means please guide me. If you gone throw online tutorials means provide link to me. it will be more helpful to me if i got some code samples
I was able to answer my own question. For those of you who would like to do the same thing, you must assign a name to each of your map elements first. Here is the code I used:
Private Sub xamWebMap_ElementClick(ByVal sender As Object, ByVal e As MapElementClickEventArgs) Dim map1 As XamWebMap = DirectCast(sender, XamWebMap) Dim i As Integer i += 1 For Each ele As MapElement In map1.Layers(0).Elements Dim builder As New StringBuilder() ele.Name = builder.Append("name" + i.ToString()).ToString i = i + 1 Next Dim elementName As String = e.Element.Name