Select to view content in your preferred language

Changing GroupLayer Type

196
4
Jump to solution
a month ago
JoeMadrigal
New Contributor III

At 3.2 they added ability to change grouplayer to either check boxes or radio buttons.  Is there a way to create a new grouplayer in code to default to radio buttons?  I'm using LayerFactory.Instance.CreateGroupLayer() to create the GroupLayer.  I can't find any methods to do so (or options in the CTOR), but maybe still too new?

Thanks,

Joe

 

0 Kudos
1 Solution

Accepted Solutions
UmaHarano
Esri Regular Contributor

@JoeMadrigal 

You can access the CIM Definition of the Group Layer to accomplish this. Code snippet:

//Construct/Create the group layer first.
var groupLayerCreationParams = new GroupLayerCreationParams();
groupLayerCreationParams.Name = "Group Layer";
var groupLayer = LayerFactory.Instance.
CreateLayer<GroupLayer>(groupLayerCreationParams, MapView.Active.Map);
//Get the CIM Definition of the group layer
var groupLayerDefinition = groupLayer.GetDefinition() as CIMGroupLayer;
//Set the "SublayerVisibilityMode" CIM property of the group layer to 
//"Independent" or "Exclusive". Use the SublayerVisibilityMode enum.
//SublayerVisibilityMode.Exclusive - Radio button
//SublayerVisibilityMode.Independent - checkbox
groupLayerDefinition.SublayerVisibilityMode = SublayerVisibilityMode.Exclusive;
//Set the modified CIM Definition back to the group layer.
groupLayer.SetDefinition(groupLayerDefinition);

View solution in original post

0 Kudos
4 Replies
UmaHarano
Esri Regular Contributor

@JoeMadrigal 

You can access the CIM Definition of the Group Layer to accomplish this. Code snippet:

//Construct/Create the group layer first.
var groupLayerCreationParams = new GroupLayerCreationParams();
groupLayerCreationParams.Name = "Group Layer";
var groupLayer = LayerFactory.Instance.
CreateLayer<GroupLayer>(groupLayerCreationParams, MapView.Active.Map);
//Get the CIM Definition of the group layer
var groupLayerDefinition = groupLayer.GetDefinition() as CIMGroupLayer;
//Set the "SublayerVisibilityMode" CIM property of the group layer to 
//"Independent" or "Exclusive". Use the SublayerVisibilityMode enum.
//SublayerVisibilityMode.Exclusive - Radio button
//SublayerVisibilityMode.Independent - checkbox
groupLayerDefinition.SublayerVisibilityMode = SublayerVisibilityMode.Exclusive;
//Set the modified CIM Definition back to the group layer.
groupLayer.SetDefinition(groupLayerDefinition);
0 Kudos
JoeMadrigal
New Contributor III

That worked great thank you.  Is there a CIM diagram that describes all the CIM definitions of most things in the map or a layout?  Seems you can modify just about anything using those definitions.

0 Kudos
JoeMadrigal
New Contributor III
0 Kudos
UmaHarano
Esri Regular Contributor

@JoeMadrigal 

You can use the CIM Viewer addin to examine the CIM Definition of objects in ArcGIS Pro. If you are on Pro 3.x, use the addin from the CIMViewer_3.x folder in the above repo.

The ReadMe file in the repo has detailed instructions on how to use the addin to view the CIM Definitions.