Knowing that it's not possible to add buttons directly on an Attribute Window, I would like to add two buttons to our custom toolbar, one would be 'Previous' and one would be 'Next'. When clicked, the selection would jump to the next feature in the row index of the active Attribute Window, as well as Zoom to the newly selected feature in the Map.
Is this possible, or is it a pipe dream?
Hi,
Yes. It is possible. TableView has method Highlight. The table view must be showing the Selected Records view.
How to get TableView from table name you can found in TableViewerTest from Esri ArcGIS Pro SDK Community samples. Code sample uses method OpenAndActivateTablePane fromTableViewerTest sample:
protected override void OnClick()
{
var myTable = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(fl => fl.Name.Equals("YourTableName")).FirstOrDefault()
?? throw new Exception(@"Can't find 'YourTableName' Layer");
var myTablePanes = Module1.OpenAndActivateTablePane(myTable);
if (myTablePanes.TablePane == null)
throw new Exception($@"Unable to activate {myTable.Name}");
TableView tableView = myTablePanes.TablePaneEx.TableView;
if (tableView == null) throw new Exception($@"Can't get TableView for {myTable.Name}");
if (tableView.IsReady && tableView.CanHighlight)
{
tableView.Highlight(237, true);
}
}
You need to listen for MapSelectionChangedEvent, collect selected objects objectid's and store current selected objectid. Selection set and current objectid I would recommend store in Module properties.
Are you referring to this attribute window?
If so, here is another approach -
you can create your own custom attribute window in Pro. It gives you an opportunity to design your own UI component, while integrating the Pro user control (in your UI) that displays the attributes of the selected features.
Here is a sample that shows this: https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Editing/EditorInspectorUI