Answered Silverlight Map Control - <MAP> tag issue

  • Tuesday, April 27, 2010 6:31 AM
     
     

    I'm using VS2010 RC and Silverlight 4. I have downloaded latest Bing Map Control SDK.

    The problem is that when i put ANY item inside <map> .... </map> tag, for example MapLayer or any shape whatever and name it - its not visible from the c# code - as if it does not exists. It does not matter I re-compile the solution or not - the result is still the same......

    Help NEEDED!!!

All Replies

  • Tuesday, April 27, 2010 6:39 PM
     
     

    Are you able to access the map from the code? If so, and assuming your map is named "map", you can try

    MapLayer layer = (MapLayer) map.FindName("mapLayerName");

     

  • Wednesday, April 28, 2010 12:35 PM
     
     

    Are you able to access the map from the code? If so, and assuming your map is named "map", you can try

    MapLayer layer = (MapLayer) map.FindName("mapLayerName");

     


    The reason why i want to make this work is to be able to edit the content (inside <map> ... </map> tags) with visual editor (integrated in vs2010 rc). And yes, from the code I do have an access to the root MAP control, but nothing inside is accessable.....

    Very confused....

  • Friday, April 30, 2010 12:13 AM
     
     
    Are there any design-time warnings or errors?
  • Wednesday, March 02, 2011 6:01 AM
    Moderator
     
     Answered

    You can certainly put a MapLayer inside the map and if you put a x:Name="Mylayer" it is acessible from within the C# code.

    full working example here:

    http://www.microsoft.com/maps/isdk/silverlight/#MapControlInteractiveSdk.Tutorials.Layers.TutorialAddRemoveShowHide


    Windows Live Developer MVP - www.soulsolutions.com.au - follow http://twitter.com/bingmapsdev for latest news.