ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MapTool Class / EmbeddableControl Property
Example

In This Topic
    EmbeddableControl Property
    In This Topic
    Gets the EmbeddableControl created for the tool. This is the control set by the ControlID property.
    Syntax
    protected EmbeddableControl EmbeddableControl {get;}
    Protected ReadOnly Property EmbeddableControl As EmbeddableControl
    Remarks
    In some cases you may need to provide a dock pane to configure the behavior of the tool while in use similar to many of the editing tools. This property returns the instance of the EmbeddableControl set by the ControlID. property. If you close the dock pane the tool will be deactivated and if you activate a different tool the dock pane will close.
    Example
    Tool with an Embeddable Control
    // Using the Visual Studio SDK templates, add a MapTool and an EmbeddableControl
    // The EmbeddableControl is registered in the "esri_embeddableControls" category in the config.daml file
    // 
    //  <categories>
    //    <updateCategory refID = "esri_embeddableControls" >
    //      <insertComponent id="mapTool_EmbeddableControl" className="EmbeddableControl1ViewModel">
    //        <content className = "EmbeddableControl1View" />
    //      </insertComponent>
    //    <updateCategory>
    //  </categories>
    internal class MapTool_WithControl : MapTool
    {
      public MapTool_WithControl()
      {
        // substitute this string with the daml ID of the embeddable control you added
        ControlID = "mapTool_EmbeddableControl";
      }
    
      protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
      {
        e.Handled = true;
      }
    
      protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
      {
        //Get the instance of the ViewModel
        var vm = EmbeddableControl;
        if (vm == null)
          return Task.FromResult(0);
    
        // cast vm to your viewModel in order to access your properties
    
        //Get the map coordinates from the click point and set the property on the ViewMode.
        return QueuedTask.Run(() =>
        {
          var mapPoint = MapView.Active.ClientToMap(e.ClientPoint);
          string clickText = string.Format("X: {0}, Y: {1}, Z: {2}", mapPoint.X, mapPoint.Y, mapPoint.Z);
        });
      }
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also