Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
845
Adding Multiple Layer
posted

Hi

   I want to add multiple layer to the map dynamically. ie i don't know how many layers im going to add at compile time. how can i do this and i want to couple mouse click event to each element.  The exact scenario is i have one layer primarily when i zoom in to the primary layer i have to show next layer at one particular zoom level and when i zoom in to the newly added layer i have to add another layer and so on. i can use  visiblefromscale property here. i am using Geo spatial data to load map.i have created a service to load shapes but here we will create client to the service in the name of layer and in the GetDateCompleted event we used to import the source. since i don't know the number of layers how can i do this... Can any one help me in this....

Parents
No Data
Reply
  • 28496
    Offline posted

    you can add a layer to the map in C# using code like this:

                MapLayer layer = new MapLayer();
                layer.Reader = new ShapeFileReader() { Uri = "usa_st" };
                this.xamWebMap1.Layers.Add(layer);
                layer.ImportAsync();

    the mouse clicks can all be handled inside the XamWebMap's ElementClick event handler.

Children