ESRI.ArcGIS.ADF.IMS
RefreshLegend Property
See Also  Example
ESRI.ArcGIS.ADF.IMS.Carto Namespace > MapView Class : RefreshLegend Property




Gets or sets a property indicating if the map's legend should be drawn when the map is drawn.

Syntax

Visual Basic (Declaration) 
Public Property RefreshLegend As Boolean
Visual Basic (Usage)Copy Code
Dim instance As MapView
Dim value As Boolean
 
instance.RefreshLegend = value
 
value = instance.RefreshLegend
C# 
public bool RefreshLegend {get; set;}

Example

The following example sets the legend to redraw when the map draws, then draws the map and displays both map and legend in image controls. The example assumes an existing MapView.
C#Copy Code
// Set legend to redraw when map draws 

mapView.RefreshLegend = true; 

  

// Set legend size to match image control (note this may cut off legend) 

mapView.Legend.Height = Convert.ToInt32(imgLegend.Height.Value); 

mapView.Legend.Width = Convert.ToInt32(imgLegend.Width.Value); 

  

// Draw the map, which draws the legend 

imgMap.ImageUrl = mapView.Draw().Url; 

  

// Display the legend just drawn 

imgLegend.ImageUrl = mapView.Legend.Image.Url; 

    
Visual BasicCopy Code
' Set legend To redraw When map draws

mapView.RefreshLegend = True



' Set legend size To match image control (note this may cut off legend)

mapView.Legend.Height = Convert.ToInt32(imgLegend.Height.Value)

mapView.Legend.Width = Convert.ToInt32(imgLegend.Width.Value)



' Draw the map, which draws the legend

imgMap.ImageUrl = mapView.Draw().Url



' Display the legend just drawn

imgLegend.ImageUrl = mapView.Legend.Image.Url

Remarks

When this property is true, a legend image is generated each time a map is drawn. This includes when the map is drawn with methods such as Pan and Zoom(double). Once drawn, the legend image URL can be retrieved from the MapView's Legend, specifically from the legend's Image.Url. When this property is false, no legend images are generated with map drawing. The legend can be drawn separately by using Legend.Draw().

The default is false. No legend is drawn on map refresh unless this property is set to true.

See Also

© 2010 All Rights Reserved.