Save a layer file in a MapControl application
This sample demonstrates how to create and save a layer file in a stand-alone ArcGIS Engine application. In addition to providing the ability to save layer files, this sample also implements a context menu that opens when you right-click a layer in the application's table of contents (TOC). This context menu hosts two commands: Save the current layer as a layer file and Remove the current layer from the map.
Language: C#, VB
Subject: Controls
Organization: Esri, http://www.esri.com
Date: 10/17/2019
ArcObjects SDK: 10.8
Visual Studio: 2017, 2019
.NET Target Framework: 4.5
Resources
Usage
- Start Visual Studio, open the solution file, and build the project.
- Press F5 to run the MapControl application.
- Use the AddData command to add a dataset to the map, or as an alternative, use Add MapDocument to add an existing map document to the map.
- Right-click a layer in the TOC to open the context menu.
- Click the Create Layer File command to save the current layer with its current renderer as a layer file.
- Use the Load Layer File command to load the new layer to the map.
See Also
How to save a layer file
Licensing
| Development licensing |
Deployment licensing |
| Engine Developer Kit |
Engine |
|
ArcGIS Desktop Basic |
|
ArcGIS Desktop Standard |
|
ArcGIS Desktop Advanced |