Map map = new Map("Map1", new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage)); map.MapUnit = GeographyUnit.DecimalDegree; map.CurrentExtent = new RectangleShape(-125, 72, 50, -46); map.MapBackground = new BackgroundLayer(new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"))); map.CustomOverlays.Add(new WorldMapKitWmsWebOverlay()); // Create a legend item for the title. LegendItem title = new LegendItem(); title.TextStyle = new TextStyle("Map Legend", new GeoFont("Arial", 10, DrawingFontStyles.Bold), new GeoSolidBrush( GeoColor.SimpleColors.Black)); // Create a legend item for the borders. This example uses a modified LineStyle. LegendItem legendItem1 = new LegendItem(); LineStyle stateBorderStyle = new LineStyle(); stateBorderStyle.OuterPen.DashStyle = LineDashStyle.Dash; stateBorderStyle.OuterPen.Width = 2; stateBorderStyle.OuterPen.Color = GeoColor.FromArgb(255, 156, 155, 154); legendItem1.ImageStyle = stateBorderStyle; legendItem1.TextStyle = new TextStyle("Borders", new GeoFont("Arial", 8), new GeoSolidBrush(GeoColor.SimpleColors.Black)); LegendItem legendItem2 = new LegendItem(); legendItem2.ImageStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 167, 204, 149)); legendItem2.TextStyle = new TextStyle("Desserts", new GeoFont("Arial", 8), new GeoSolidBrush(GeoColor.SimpleColors.Blue)); // Create A legend item for the airports. This example uses a .png file. LegendItem legendItem3 = new LegendItem(); legendItem3.TextStyle = new TextStyle("Airports", new GeoFont("Arial", 8), new GeoSolidBrush(GeoColor.SimpleColors.Black)); // Create the LegendAdornmentLayer and add the LegendItems. LegendAdornmentLayer legendLayer = new LegendAdornmentLayer(); legendLayer.BackgroundMask = AreaStyles.CreateLinearGradientStyle(new GeoColor(255, 255, 255, 255), new GeoColor(255, 230, 230, 230), 90, GeoColor.SimpleColors.Black); legendLayer.LegendItems.Add(legendItem1); legendLayer.LegendItems.Add(legendItem2); legendLayer.LegendItems.Add(legendItem3); legendLayer.Height = 125; legendLayer.Title = title; legendLayer.Location = AdornmentLocation.LowerLeft; AdornmentOverlay adornmentOverlay = new AdornmentOverlay("MapL"); adornmentOverlay.Layers.Add("LengendLayer", legendLayer); adornmentOverlay.IsBaseOverlay = false; map.AdornmentOverlay.Layers.Add(legendLayer); return View(map);