I tried to pass a heading to a dockpane but it returned the dockpane was null on ArcGIS Pro 3.11.
protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
{
// select the first point feature layer in the active map
var pointLayer = ActiveMapView.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().
Where(lyr => lyr.ShapeType == esriGeometryType.esriGeometryPoint).FirstOrDefault();
if (pointLayer == null)
return Task.FromResult(true);
Dockpane2ViewModel.Show();
// execute the select on the MCT
QueuedTask.Run(() =>
{
// define the spatial query filter
var spatialQuery = new SpatialQueryFilter() { FilterGeometry = geometry, SpatialRelationship = SpatialRelationship.Intersects };
// gather the selection
var pointSelection = pointLayer.Select(spatialQuery);
List<long> oids = pointSelection.GetObjectIDs().ToList();
if (oids.Count == 0)
return;
// show the first selected item in the attribute inspector
var inspector = Module1.AttributeInspector;
inspector?.LoadAsync(pointLayer, oids[0]);
// update the heading
Module1.Pane2ViewModel.Heading = $@"Loaded [OID]:{oids[0]}";
});
return Task.FromResult(true);
}
on Module1
private static Dockpane2ViewModel _dockpane2ViewModel = null;
internal static Dockpane2ViewModel Pane2ViewModel
{
get { return _dockpane2ViewModel; }
set { _dockpane2ViewModel = value; }
}