@@ -24,16 +24,16 @@ namespace ArcGISRuntime.Samples.ChangeBasemap
2424 public partial class ChangeBasemap : ContentPage
2525 {
2626 // Dictionary that associates names with basemaps.
27- private readonly Dictionary < string , Basemap > _basemapOptions = new Dictionary < string , Basemap > ( )
27+ private readonly Dictionary < string , BasemapStyle > _basemapOptions = new Dictionary < string , BasemapStyle > ( )
2828 {
29- { "Streets" , new Basemap ( BasemapStyle . ArcGISStreets ) } ,
30- { "Streets - Night" , new Basemap ( BasemapStyle . ArcGISStreetsNight ) } ,
31- { "Imagery" , new Basemap ( BasemapStyle . ArcGISImageryStandard ) } ,
32- { "Imagery with Labels" , new Basemap ( BasemapStyle . ArcGISImagery ) } ,
33- { "Dark Gray Canvas" , new Basemap ( BasemapStyle . ArcGISDarkGray ) } ,
34- { "Light Gray Canvas" , new Basemap ( BasemapStyle . ArcGISLightGray ) } ,
35- { "Navigation" , new Basemap ( BasemapStyle . ArcGISNavigation ) } ,
36- { "OpenStreetMap" , new Basemap ( BasemapStyle . OSMStandard ) }
29+ { "Streets" , BasemapStyle . ArcGISStreets } ,
30+ { "Streets - Night" , BasemapStyle . ArcGISStreetsNight } ,
31+ { "Imagery" , BasemapStyle . ArcGISImageryStandard } ,
32+ { "Imagery with Labels" , BasemapStyle . ArcGISImagery } ,
33+ { "Dark Gray Canvas" , BasemapStyle . ArcGISDarkGray } ,
34+ { "Light Gray Canvas" , BasemapStyle . ArcGISLightGray } ,
35+ { "Navigation" , BasemapStyle . ArcGISNavigation } ,
36+ { "OpenStreetMap" , BasemapStyle . OSMStandard }
3737 } ;
3838
3939 public ChangeBasemap ( )
@@ -54,17 +54,14 @@ private async void OnChangeBasemapButtonClicked(object sender, EventArgs e)
5454 if ( ! selectedBasemap . ToLower ( ) . Equals ( "cancel" ) )
5555 {
5656 // Retrieve the basemap from the dictionary
57- MyMapView . Map . Basemap = _basemapOptions [ selectedBasemap ] ;
57+ MyMapView . Map . Basemap = new Basemap ( _basemapOptions [ selectedBasemap ] ) ;
5858 }
5959 }
6060
6161 private void Initialize ( )
6262 {
63- // Create new Map with basemap
64- Map myMap = new Map ( BasemapStyle . ArcGISTopographic ) ;
65-
6663 // Assign the map to the MapView
67- MyMapView . Map = myMap ;
64+ MyMapView . Map = new Map ( BasemapStyle . ArcGISTopographic ) ;
6865 }
6966 }
7067}
0 commit comments