ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Framework.Contracts Namespace / PaneBase Class / OnDrop Method
The data being dropped.
Example Version

OnDrop Method (PaneBase)
Invoked when an object is dropped onto the pane. Implement this method to add class handling for this event.
Syntax
public virtual void OnDrop( 
   DropInfo dropInfo
)

Parameters

dropInfo
The data being dropped.
Remarks

Panes and DockPanes that have registered themselves as drop targets (DAML isDropTarget) and have set DropInfo.Effects appropriately in OnDragOver, are automatically called by the framework whenever an object is dropped on them.

public override void OnDrop(ArcGIS.Desktop.Framework.DragDrop.DropData dropData) { foreach (var item in dropData.Items) { if (System.IO.Path.GetExtension(item.Data as string) == ".txt") { item.Handled = true; ReadTextFile(item.Data as string); return; } } }
Example
public override void OnDrop(ArcGIS.Desktop.Framework.DragDrop.DropData dropData)
{
  foreach (var item in dropData.Items)
  {
    if (System.IO.Path.GetExtension(item.Data as string) == ".txt")
    {
      item.Handled = true;
      ReadTextFile(item.Data as string);
      return;
    }
  }
}
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also