private void ComboBox_SelectionChanged(object sender, EventArgs e)
        {
            var combo = sender as ComboBox;
            var sel   = combo.SelectedItem as ComboBoxItem;

            if (sel.Tag == null)
            {
                return;
            }

            // Find and remove the current basemap layer from the map
            if (MyMap == null)
            {
                return;
            }
            var oldBasemap = MyMap.Layers["BaseMap"];

            MyMap.Layers.Remove(oldBasemap);

            // Create a new basemap layer
            var newBasemap = new Esri.ArcGISRuntime.Layers.ArcGISTiledMapServiceLayer();

            // Set the ServiceUri with the url defined for the ComboBoxItem's Tag
            newBasemap.ServiceUri = sel.Tag.ToString();

            // Give the layer the same ID so it can still be found with the code above
            newBasemap.ID = "BaseMap";

            // Insert the new basemap layer as the first (bottom) layer in the map
            MyMap.Layers.Insert(0, newBasemap);
        }
        private void cBoxBaseMaps_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            btnGetParvelAddress.Visibility  = Visibility.Collapsed;
            pnlParcelAddressInfo.Visibility = Visibility.Collapsed;
            btnGetRoute.Visibility          = Visibility.Collapsed;
            txtFrom.Visibility = Visibility.Collapsed;
            txtTo.Visibility   = Visibility.Collapsed;

            Esri.ArcGISRuntime.Controls.Map map = new Esri.ArcGISRuntime.Controls.Map();
            Esri.ArcGISRuntime.Layers.ArcGISTiledMapServiceLayer baseMaplayer = new Esri.ArcGISRuntime.Layers.ArcGISTiledMapServiceLayer();
            baseMaplayer.ServiceUri = "http://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer";
            baseMaplayer.ID         = "BaseMap";

            map.Layers.Add(baseMaplayer);

            if (cBoxBaseMaps.SelectedItem.ToString() == "Projects")
            {
                ArcGISDynamicMapServiceLayer layer2 = new ArcGISDynamicMapServiceLayer();
                layer2.ServiceUri = "http://192.168.1.47:6080/arcgis/rest/services/PROJECTS/MapServer";
                layer2.ID         = "Projects";
                map.Layers.Add(layer2);
            }
            else if (cBoxBaseMaps.SelectedItem.ToString() == "Feature")
            {
                btnGetParvelAddress.Visibility  = Visibility.Visible;
                pnlParcelAddressInfo.Visibility = Visibility.Visible;
                ServiceFeatureTable featureTable = new ServiceFeatureTable();
                featureTable.ServiceUri = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0";
                featureTable.Where      = "has_pool = 1 AND pool_permit = 0";
                FeatureLayer   layer    = new FeatureLayer(featureTable);
                SimpleRenderer renderer = new SimpleRenderer();
                renderer.Symbol = new SimpleFillSymbol()
                {
                    Color = Color.FromRgb(66, 134, 244), Style = SimpleFillStyle.DiagonalCross
                };
                layer.Renderer = renderer;

                map.InitialViewpoint = new Viewpoint(new Envelope(-13075816.40, 4014771.46, -13073005.67, 4016869.78));

                layer.ID = "Feature";
                map.Layers.Add(layer);
            }
            else if (cBoxBaseMaps.SelectedItem.ToString() == "Route")
            {
                btnGetRoute.Visibility = Visibility.Visible;
                txtFrom.Visibility     = Visibility.Visible;
                txtTo.Visibility       = Visibility.Visible;

                GraphicsLayer layer2 = new GraphicsLayer();
                layer2.ID = "Graphics";
                map.Layers.Add(layer2);
            }
            else if (cBoxBaseMaps.SelectedItem.ToString() == "Map 1")
            {
                map = new Map();
                ArcGISTiledMapServiceLayer ArcGISTiledMapServiceLayer1 = new ArcGISTiledMapServiceLayer();
                ArcGISTiledMapServiceLayer1.ServiceUri = "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer";
                ArcGISTiledMapServiceLayer1.ID         = "World_Light_Gray_Base";

                Esri.ArcGISRuntime.Layers.ArcGISDynamicMapServiceLayer ArcGISDynamicMapServiceLayer1 = new Esri.ArcGISRuntime.Layers.ArcGISDynamicMapServiceLayer();
                ArcGISDynamicMapServiceLayer1.ServiceUri = "http://services.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_1990-2000_Population_Change/MapServer";
                ArcGISDynamicMapServiceLayer1.ID         = "USA_1990-2000_Population_Change";

                map.Layers.Add(ArcGISTiledMapServiceLayer1);
                map.Layers.Add(ArcGISDynamicMapServiceLayer1);

                mapView.Map = map;
            }
            else if (cBoxBaseMaps.SelectedItem.ToString() == "Map 3")
            {
                map = new Esri.ArcGISRuntime.Controls.Map();
                Esri.ArcGISRuntime.Layers.ArcGISTiledMapServiceLayer ArcGISTiledMapServiceLayer3 = new Esri.ArcGISRuntime.Layers.ArcGISTiledMapServiceLayer();
                ArcGISTiledMapServiceLayer3.ServiceUri = "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer";
                ArcGISTiledMapServiceLayer3.ID         = "World_Light_Gray_Base";

                Esri.ArcGISRuntime.Layers.FeatureLayer      FeatureLayer3        = new Esri.ArcGISRuntime.Layers.FeatureLayer();
                Esri.ArcGISRuntime.Data.ServiceFeatureTable ServiceFeatureTable3 = new Esri.ArcGISRuntime.Data.ServiceFeatureTable();
                ServiceFeatureTable3.ServiceUri = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer/0";
                ServiceFeatureTable3.OutFields  = Esri.ArcGISRuntime.Tasks.Query.OutFields.All;
                FeatureLayer3.FeatureTable      = ServiceFeatureTable3;

                map.Layers.Add(ArcGISTiledMapServiceLayer3);
                map.Layers.Add(FeatureLayer3);

                mapView.Map = map;
            }

            mapView.Map = map;
        }