New to Telerik UI for WinForms? Download free 30-day trial

Legend

The RadMap control introduces the MapLegendElement object. It allows displaying a legend for a particular layer inside the control.

Figure 1: Map Legend

WinForms RadMap Legend

Setup Legends

Legend items can be added by accessing the Children collection of the legend stack element. The code fragment below extends the Layers Overview example by adding two legends.

Figure 2: Setup Legends

WinForms RadMap Setup Legends

Customizing Appearance

this.radMap1.MapElement.LegendElement.TitleElement.Text = "NBA";
this.radMap1.MapElement.LegendElement.SubtitleElement.Text = "Conferences";
this.radMap1.MapElement.LegendElement.Orientation = Orientation.Horizontal;
this.radMap1.MapElement.LegendElement.ItemStackElement.Children.Add(new MapLegendItemElement("Western", Color.Red));
this.radMap1.MapElement.LegendElement.ItemStackElement.Children.Add(new MapLegendItemElement("Eastern", Color.Blue));

Me.RadMap1.MapElement.LegendElement.TitleElement.Text = "NBA"
Me.RadMap1.MapElement.LegendElement.SubtitleElement.Text = "Conferences"
Me.RadMap1.MapElement.LegendElement.Orientation = Orientation.Horizontal
Me.RadMap1.MapElement.LegendElement.ItemStackElement.Children.Add(New MapLegendItemElement("Western", Color.Red))
Me.RadMap1.MapElement.LegendElement.ItemStackElement.Children.Add(New MapLegendItemElement("Eastern", Color.Blue))

See Also

In this article