private void WpfMap_Loaded(object sender, RoutedEventArgs e) { wpfMap1.MapUnit = GeographyUnit.DecimalDegree; WorldMapKitWmsWpfOverlay worldMapKitOverlay = new WorldMapKitWmsWpfOverlay(); MapArguments a = worldMapKitOverlay.MapArguments; wpfMap1.Overlays.Add("WorldMap",worldMapKitOverlay); ShapeFileFeatureLayer countries = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\Countries02.shp"); countries.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green)); countries.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay StaticOverlay = new LayerOverlay(); a= StaticOverlay.MapArguments; StaticOverlay.TransitionEffect = TransitionEffect.None; StaticOverlay.Layers.Add("Countries", countries); wpfMap1.Overlays.Add("StaticOverlay", StaticOverlay); wpfMap1.CurrentExtent = new RectangleShape(-133.2515625, 89.2484375, 126.9046875, -88.290625); wpfMap1.Refresh(); } private void CheckBox_Click(object sender, RoutedEventArgs e)// bind all checkboxs’ click event to this “private void CheckBox_Click(object sender, RoutedEventArgs e)” { wpfMap1.Overlays.Remove("WorldMap"); wpfMap1.Overlays.Remove("StaticOverlay"); LayerOverlay layerOverlay = new LayerOverlay(); if ((bool)chkWorldMapKit.IsChecked) { WorldMapKitWmsWpfOverlay worldMapKitDesktopOverlay = new WorldMapKitWmsWpfOverlay(); wpfMap1.Overlays.Add("WorldMap", worldMapKitDesktopOverlay); } if ((bool)chkCountries.IsChecked) { ShapeFileFeatureLayer countries = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\Countries02.shp"); countries.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green)); countries.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; layerOverlay.Layers.Add("Countries", countries); } if ((bool)chkUsStates.IsChecked) { ShapeFileFeatureLayer usStates = new ShapeFileFeatureLayer(@"..\..\sampledata\data\usStates.shp"); usStates.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.State1; usStates.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; layerOverlay.Layers.Add("usStates", usStates); } if ((bool)chkWorldCapitals.IsChecked) { ShapeFileFeatureLayer worldCapitals = new ShapeFileFeatureLayer(@"..\..\sampledata\data\worldCapitals.shp"); worldCapitals.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.Capital1; worldCapitals.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; layerOverlay.Layers.Add("worldCapitals", worldCapitals); } if ((bool)chkMajorCities.IsChecked) { ShapeFileFeatureLayer MajorCities = new ShapeFileFeatureLayer(@"..\..\sampledata\data\MajorCities.shp"); MajorCities.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.City1; MajorCities.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; layerOverlay.Layers.Add("MajorCities", MajorCities); } wpfMap1.Overlays.Add("StaticOverlay", layerOverlay); if (wpfMap1.Overlays.Contains("WorldMap")) { wpfMap1.Refresh(wpfMap1.Overlays["WorldMap"]); } wpfMap1.Refresh(wpfMap1.Overlays["StaticOverlay"]); }