ArcGIS Pro 3.1 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 static IPlugInWrapper GetPlugInWrapper( 
       string id,
       bool create
    )
    Public Shared Function GetPlugInWrapper( _
       ByVal id As String, _
       Optional ByVal create As Boolean _
    ) As IPlugInWrapper

    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
    var plugin = FrameworkApplication.GetPlugInWrapper("esri_editing_EditVerticesText");
    if (plugin.Enabled)
      ((ICommand)plugin).Execute(null);
    Execute a command
    IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("esri_editing_ShowAttributes");
    var command = wrapper as ICommand; // tool and command(Button) supports this
    
    if ((command != null) && command.CanExecute(null))
      command.Execute(null);
    
    Set the current tool
    // use SetCurrentToolAsync
    FrameworkApplication.SetCurrentToolAsync("esri_mapping_selectByRectangleTool");
    
    // or use ICommand.Execute
    ICommand cmd = FrameworkApplication.GetPlugInWrapper("esri_mapping_selectByRectangleTool") as ICommand;
    if ((cmd != null) && cmd.CanExecute(null))
      cmd.Execute(null);
    Change a buttons caption or image
    private void ChangeCaptionImage()
    {
      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("T-Rex16.png");
        wrapper.LargeImage = BuildImage("T-Rex32.png");
      }
    }
    
    private ImageSource BuildImage(string imageName)
    {
      return new BitmapImage(PackUriForResource(imageName));
    }
    
    private Uri PackUriForResource(string resourceName)
    {
      string asm = System.IO.Path.GetFileNameWithoutExtension(
          System.Reflection.Assembly.GetExecutingAssembly().Location);
      return new Uri(string.Format("pack://application:,,,/{0};component/Images/{1}", asm, resourceName), UriKind.Absolute);
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also