public partial class AddAnInMemoryMarkerOverlay : UserControl { public AddAnInMemoryMarkerOverlay() { InitializeComponent(); } private void WpfMap_Loaded(object sender, RoutedEventArgs e) { wpfMap1.MapUnit = GeographyUnit.DecimalDegree; wpfMap1.CurrentExtent = new RectangleShape(-155.733, 95.60, 104.42, -81.9); WorldMapKitWmsWpfOverlay worldMapKitOverlay = new WorldMapKitWmsWpfOverlay(); wpfMap1.Overlays.Add(worldMapKitOverlay); InMemoryMarkerOverlay markerOverlay = new InMemoryMarkerOverlay(); markerOverlay.Columns.Add(new FeatureSourceColumn("Name")); markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultPointMarkerStyle.ImageSource = new BitmapImage(new Uri("/Resources/AQUA.png", UriKind.RelativeOrAbsolute)); markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultPointMarkerStyle.Width = 20; markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultPointMarkerStyle.Height = 34; markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultPointMarkerStyle.YScreenOffset = -17; markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultPointMarkerStyle.ToolTip = "This is [#Name#]."; markerOverlay.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; wpfMap1.Overlays.Add("MarkerOverlay", markerOverlay); markerOverlay.FeatureSource.BeginTransaction(); Random random = new Random(); for (int i = 0; i < 30; i++) { Feature newFeature = new Feature(random.Next(-180, 180), random.Next(-90, 90)); newFeature.ColumnValues.Add("Name", "Lawrence"); markerOverlay.FeatureSource.AddFeature(newFeature); } markerOverlay.FeatureSource.CommitTransaction(); wpfMap1.Refresh(); } private void Button1_Click(object sender, RoutedEventArgs e) { if (wpfMap1.Overlays.Contains("MarkerOverlay")) { wpfMap1.Overlays.Remove("MarkerOverlay"); } } }