Describes a legend swatch (value and image).
Syntax
Visual Basic (Declaration) | |
---|
Public Class LegendSwatch |
C# | |
---|
public class LegendSwatch |
Example
The example below demonstrates how to get bitmaps for all symbols in the map
and display them in a listview control.
The sample assumes that in addition to a map control (Map1) and mobileService1
components you have a control named imageList1 component
placed on your form.
C# | Copy Code |
---|
ListView listView1 = new ListView(); listView1.LargeImageList = imageList1; listView1.SmallImageList = imageList1; foreach (MapLayer mlayer in map1.MapLayers) { ListViewItem itemA = new ListViewItem(mlayer.Name, 0); //get the mobilecachemaplayer to get the renderer to get the legendswatch MobileCacheMapLayer mclayer = mlayer as MobileCacheMapLayer; IList <LegendSwatch> legendswat = mclayer.Layer.Renderer.GetLegendSwatches(Color.White, 16 , 16); //get image to put in legend Image myimage = legendswat.FirstOrDefault().Image; imageListSmall.Images.Add(myimage); itemA.SubItems.Add(legendswat[0].Label); itemA.SubItems.Add(legendswat.Count.ToString()); itemA.ImageIndex = i++; //add currrent item to list listView1.Items.Add(itemA); } // Add the ListView to the control collection. this.Controls.Add(listView1); |
Inheritance Hierarchy
System.Object
ESRI.ArcGIS.Mobile.LegendSwatch
Requirements
Namespace: ESRI.ArcGIS.Mobile
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family
Assembly: ESRI.ArcGIS.Mobile (in ESRI.ArcGIS.Mobile.dll)
See Also