Using the SymbologyControl

In this topic

About using the SymbologyControl

The SymbologyControl is used to display the contents of Server Style files (*.ServerStyle) and custom symbology. If ArcGIS for Desktop is installed, the contents of the Style files (*.Style) can also be displayed. The SymbologyControl enables an end user to select an individual symbol that can be applied to part of an application, such as a layer's renderer or an element's symbol. See the following screen shot:

Loading Server Style files

Server styles are collections of symbols and map elements that are often grouped by functionality. For example, symbols and map elements used by the transportation industry can be grouped into a transportation server style.
Server styles are stored in files that have a .ServerStyle extension. ESRI provides several styles for you to use out-of-the-box. These styles are found under <ARCGISInstallDir>\Styles. You will find commonly used symbols and map elements in ESRI.ServerStyle and more domain-specific style items in relevantly named .ServerStyle files (for example, Transportation.ServerStyle).
A style is composed of several style items. These style items provide access to individual map elements and symbols. Style items are organized into style classes, which are types of style items. A style class can have several groups of items organized into categories. For example, Precipitation is a style item that belongs to the Color Ramps style class in the Default Ramps category. See the following screen shot:
A Style file is similar to a Server Style file, except it has a .Style extension rather than a .ServerStyle extension. Style files are available to ArcGIS for Desktop products only, whereas Server Style files are available to all ArcGIS products.
Server Style files can be loaded at design time through the SymbologyControl property editor (in development environments that support property page capability), and the SymbologyControl can be set to link to the symbology. The SymbologyControl reads the Server Style files whenever the SymbologyControl is created on the container. Alternatively, Server Style files can be loaded into the SymbologyControl programmatically using the loadStyleFile() method and removed using the removeFile() method.
See the following code example:
String ArcGISInstallDir = System.getenv("AGSDESKTOPJAVA");
symbologyControl.loadStyleFile(ARCGISInstallDir + "Styles/ESRI.ServerStyle");


The SymbologyControl displays the contents of one SymbologyStyleClass at any one time (for example, marker symbols or north arrow symbols). Use the ISymbologyControl.setStyleClass() method to set the current SymbologyStyleClass and the ISymbologyControl.getStyleClass() method to return a specific SymbologyStyleClass. The ISymbologyStyleClass interface has attributes and methods for managing each ServerStyleGalleryItem in a SymbologyStyleClass. Individual items can be removed, selected, and previewed using the removeItem(), selectItem(), and previewItem() methods. Custom symbology can be added using the addItem() method.
See the following code example:
ISymbologyStyleClass styleClass = symbologyControl.getStyleClass2
IStyleGalleryItem serverStyleGalleryItem = styleClass.getSelectedItem();
System.out.println("Name :" + serverStyleGalleryItem.getName());
When the contents of a Server Style file are loaded into the SymbologyControl with the loadStyleFile() method, items are demand loaded to the end of a SymbologyStyleClass item collection. This is done to increase performance and means items are only loaded into a SymbologyStyleClass when it is the current StyleClass. To increase the speed at which items display in the SymbologyControl, the update() method can be used to force items to be loaded into a SymbologyStyleClass when it is not the current StyleClass.

See Also:

Controls library overview
How to set SymbologyControl properties

Development licensingDeployment licensing
Engine Developer KitEngine
ArcGIS for Desktop Basic
ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced