Open Layout properties window

293
2
Jump to solution
09-21-2021 08:24 AM
FredB
by
New Contributor II

Hello,

I'm trying to open the layout properties window without much success. 

 

var wrapper = FrameworkApplication.GetPlugInWrapper("esri_layouts_propertySheet");

var command = wrapper as ICommand;
if (command == null)
return;

// execute the command
if (command.CanExecute(null))
command.Execute(null);

 

 

I have an activeView. But the wrapper is always null. 

 

Any idea ? Thanks !

 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Wolf
by Esri Regular Contributor
Esri Regular Contributor

The reason why you get a <null> returned is because this item doesn't implement an ICommand (i.e. button).  If you use esri_layouts_layoutPropertiesButton instead of the property page DAML, your code should work.  To find the appropriate DAML Id you can either use the DAML reference here: DAML ID Reference ArcGISLayout.daml · ArcGIS/arcgis-pro-sdk Wiki (github.com) or you can enable the this Pro option:

Wolf_0-1632239272335.png

Once enabled you can see the DAML Id as a tooltip:

Wolf_1-1632239321035.png

 

View solution in original post

0 Kudos
2 Replies
Wolf
by Esri Regular Contributor
Esri Regular Contributor

The reason why you get a <null> returned is because this item doesn't implement an ICommand (i.e. button).  If you use esri_layouts_layoutPropertiesButton instead of the property page DAML, your code should work.  To find the appropriate DAML Id you can either use the DAML reference here: DAML ID Reference ArcGISLayout.daml · ArcGIS/arcgis-pro-sdk Wiki (github.com) or you can enable the this Pro option:

Wolf_0-1632239272335.png

Once enabled you can see the DAML Id as a tooltip:

Wolf_1-1632239321035.png

 

View solution in original post

0 Kudos
UmaHarano
Esri Regular Contributor

Here is a code snippet to help you -

      //Get the selected item in the Catalog pane
      //Cast as Layout Project item.
      var selectedLayout = Project.GetCatalogPane(true)?.SelectedItems.FirstOrDefault() as LayoutProjectItem;
      if (selectedLayout == null) return;
      //Call Pro's Command to open the selected layout
      // ArcGIS Pro Command's DAML ID. 
      var commandId = "esri_layouts_projectItem_LayoutProperties";
      // get the ICommand interface from the ArcGIS Pro Button
      // using command's plug-in wrapper
      var iCommand = FrameworkApplication.GetPlugInWrapper(commandId) as ICommand;
      if (iCommand != null)
      {
        // Let ArcGIS Pro do the work for us
        if (iCommand.CanExecute(null))
        {
          iCommand.Execute(null);
        }
      }
0 Kudos