DotSpatial.Controls.Legend - sindizzy/DSW GitHub Wiki

Legend Control

[Image:Legend.png)(Image_Legend.png)

Description The legend control organizes a view of the layers in the map. While the map shows the layer content, functionally it only offers basic selection and navigation by default, and will depend on apps to make it truly fully featured as a control. The legend, on the other hand, is extremely important for organizing the order of the layers, launching dialogs to apply symbology and labeling. It also allows exporting the underlying dataset, selecting by attributes, setting up a dynamic visibility range and something as basic as turning layers on and off with a checkbox. It also allows easy renaming of the layer.

Adding a Legend Control Using the legend consists of two stages. The first stage is adding a map and a legend to your form. You will need to choose items from the DotSpatial.Controls.dll in order to add the controls to your Visual Studio toolbox. Without a map to control, you really can't do much with the legend. It is not designed to be as cross-purpose as a toolbar, but rather a specialized helper utility for organizing data layers in the map. Just adding a legend isn't quite enough, however. The Map has a property on it which specifies what legend it should appear in. Legends can host layers from multiple maps, but this isn't a commonly used or well tested feature. By setting the "Legend" property in the map, your layers should appear in the legend.