ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Framework Namespace / FrameworkApplication Class / GetPlugInWrapper Method
The DAML control identifier.
Load the component if it hasn't been created yet.
Example

In This Topic
    GetPlugInWrapper Method
    In This Topic
    Returns a run-time wrapper around the specified DAML component.
    Syntax
    Public Shared Function GetPlugInWrapper( _
       ByVal id As String, _
       Optional ByVal create As Boolean _
    ) As IPlugInWrapper
    public static IPlugInWrapper GetPlugInWrapper( 
       string id,
       bool create
    )

    Parameters

    id
    The DAML control identifier.
    create
    Load the component if it hasn't been created yet.

    Return Value

    A
    Example
    Programmatically start Edit Annotation
    // programmatically activates the Edit Annotation tool by invoking the corresponding
    // plugin. The tool must be enabled for the operation to succeed.
    {
      var plugin = FrameworkApplication.GetPlugInWrapper("esri_editing_EditVerticesText");
      if (plugin.Enabled)
        ((ICommand)plugin).Execute(null);
    }
    Execute a command
    {
      IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("esri_editing_ShowAttributes");
      // tool and command(Button) supports this
    
      if (wrapper is ICommand command && command.CanExecute(null))
        command.Execute(null);
    }
    Set the current tool
    {
      // use SetCurrentToolAsync with await
      FrameworkApplication.SetCurrentToolAsync("esri_mapping_selectByRectangleTool").Wait();
    
      // or use ICommand.Execute
      if (FrameworkApplication.GetPlugInWrapper("esri_mapping_selectByRectangleTool") is ICommand cmd && cmd.CanExecute(null))
        cmd.Execute(null);
    }
    Change a buttons caption or image
    {
      IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("MyAddin_MyCustomButton");
      if (wrapper != null)
      {
        wrapper.Caption = "new caption";
    
        // ensure that T-Rex16 and T-Rex32 are included in your add-in under the images folder and have 
        // BuildAction = Resource and Copy to OutputDirectory = Do not copy
        wrapper.SmallImage = buildImage;
        wrapper.LargeImage = buildImage2;
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also