InMemoryFeatureLayer inmLayer = new InMemoryFeatureLayer(); private double[] nScaleValue = new double[] { 0, 10000, 20000, 30000, 40000 }; //I used the colors randomly. private GeoColor[] ScaleColors = new GeoColor[] { GeoColor.StandardColors.Black, GeoColor.StandardColors.Red, GeoColor.StandardColors.Green, GeoColor.StandardColors.Blue, GeoColor.StandardColors.Yellow }; private void WpfMap_Loaded(object sender, RoutedEventArgs e) { Map1.MapUnit = GeographyUnit.DecimalDegree; string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + @"ageresults.xls" + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1;\";"; OleDbConnection conn = new OleDbConnection(connString); string cmd = "select * from [sheet1$]"; conn.Open(); OleDbCommand command = new OleDbCommand(cmd, conn); OleDbDataAdapter adapter = new OleDbDataAdapter(command); DataSet ds = new DataSet(); adapter.Fill(ds, "[Sheet1$]"); DataTable table = ds.Tables[0]; conn.Close(); SetupFeatures(table); ClassBreakStyle Breaks = new ClassBreakStyle("TotalSelected"); for (int j = 0; j < 5; j++) { AreaStyle aStyle = new AreaStyle(new GeoPen(GeoColor.StandardColors.Black), new GeoSolidBrush(GeoColor.FromArgb(100, ScaleColors[j]))); Breaks.ClassBreaks.Add(new ClassBreak(nScaleValue[j], aStyle)); } inmLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(Breaks); inmLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay overlay = new LayerOverlay(); overlay.Layers.Add("DetailLayer1", inmLayer); Map1.Overlays.Add("DetailLayer", overlay); inmLayer.Open(); Map1.CurrentExtent = inmLayer.GetBoundingBox(); Map1.Refresh(); } public void SetupFeatures(DataTable MapTable) { inmLayer.Open(); inmLayer.Columns.Add(new FeatureSourceColumn("TotalSelected")); foreach (DataRow row in MapTable.Rows) { string wkt = row["location"].ToString().Trim(); //there are some invalid wkt; if (!wkt.Contains("))") || (wkt.Contains("MULTI") && !wkt.Contains(")))"))) { continue; } Feature feature = new Feature(wkt, row["name"].ToString()); foreach (DataColumn Col in MapTable.Columns) { string Value = row[Col.ColumnName].ToString(); feature.ColumnValues.Add(Col.ColumnName, Value); } inmLayer.InternalFeatures.Add(feature); } }