ContextMenuDataContextAs<T> Method
In This Topic
Gets the contextual data as the requested type T. Contextual data represents the selected item (or items) that is passed
to a command when executing that command on a context menu.
Syntax
public static ContextMenuDataContextAs<>()
where T: class
Public Shared Function ContextMenuDataContextAs(Of As Class)() As
Type Parameters
- T
Return Value
The contextual data as a T if supported, null otherwise.
Example
Retrieve SelectionSet from command added to Attribute Pane Context Menu
await QueuedTask.Run(async () =>
{
var selSet = FrameworkApplication.ContextMenuDataContextAs<SelectionSet>();
if (selSet == null)
return;
int count = selSet.Count;
if (count == 0)
return;
var op = new EditOperation();
op.Name = "Delete context";
op.Delete(selSet);
await op.ExecuteAsync();
});
Requirements
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3.1 or higher.
See Also