I'm trying to use an MVVM framework to update the map's basemap layer via a bound Map:Layers property. I can update the Layers property through code-behind, but I'm so far unable to get the basemap layer to update when using the MVVM framework. Can you take a look and see if you can tell me what I'm doing wrong (or if this is possible)?Below is the code I'm attempting to use.First the XAML map binding (I've already set a reference to my view model in Resources): <esri:Map x:Name="myMap" Grid.Row="0" Extent="-160,15,-75,80" Layers="{Binding Source={StaticResource myViewModel}, Path=MyLayers,Mode=TwoWay}">
Next the property that I'm attempting to bind to: private LayerCollection _myLayers = new LayerCollection();
public LayerCollection MyLayers
{
get { return _myLayers; }
set
{
if (!object.ReferenceEquals(_myLayers, value))
{
_myLayers = value;
OnPropertyChanged("MyLayers");
}
}
}
Finally the code that updates the MyLayers property: ArcGISTiledMapServiceLayer tempBaseLayer = new ArcGISTiledMapServiceLayer();
tempBaseLayer.Url = "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer";
LayerCollection tempLayerCollection = new LayerCollection();
tempLayerCollection.Add(tempBaseLayer);
MyLayers = tempLayerCollection;
Thanks,Andrew