public void SelectLayers( IReadOnlyCollection<Layer> layers )
Public Sub SelectLayers( _ ByVal layers As IReadOnlyCollection(Of Layer) _ )
Parameters
- layers
public void SelectLayers( IReadOnlyCollection<Layer> layers )
Public Sub SelectLayers( _ ByVal layers As IReadOnlyCollection(Of Layer) _ )
public void SelectAllFeatureLayersInTOC() { //Get the active map view. var mapView = MapView.Active; if (mapView == null) return; //Zoom to the selected layers in the TOC var featureLayers = mapView.Map.Layers.OfType<FeatureLayer>(); mapView.SelectLayers(featureLayers.ToList()); }
// get the layer you want var layer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault(); // select it in the TOC List<Layer> layersToSelect = new List<Layer>(); layersToSelect.Add(layer); MapView.Active.SelectLayers(layersToSelect); // now execute the layer properties command var wrapper = FrameworkApplication.GetPlugInWrapper("esri_mapping_selectedLayerPropertiesButton"); var command = wrapper as ICommand; if (command == null) return; // execute the command if (command.CanExecute(null)) command.Execute(null);
Target Platforms: Windows 11, Windows 10