How can you get a table object from the active table pane?

639
2
Jump to solution
06-20-2022 01:31 PM
JohnPhillipsGeo
New Contributor III

We are trying to build a tool which manipulates rows in the active table pane.   Normally, I would use the MapView.Active.Map pattern to access the Table, but I cannot find a method for the active table.

The ProApp.Panes.ActivePane.InstanceID method returns ArcGIS.Desktop.Editing.TablePaneViewModel, but I cannot get the table object from the view model to pass to my other code.

What is the best way to access the active table in a project as an object?

Thanks!

0 Kudos
1 Solution

Accepted Solutions
CharlesMacleod
Esri Regular Contributor

Cast the pane to ITablePane. From ITablePane get its MapMember. The MapMember will either be a layer or a standalone table. https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/index.html#topic18696.html

If you are wanting to get the currently selected (standalone) table from the contents view instead you can use MapView.Active.GetSelectedStandaloneTables() https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/index.html#topic11959.html 

View solution in original post

2 Replies
CharlesMacleod
Esri Regular Contributor

Cast the pane to ITablePane. From ITablePane get its MapMember. The MapMember will either be a layer or a standalone table. https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/index.html#topic18696.html

If you are wanting to get the currently selected (standalone) table from the contents view instead you can use MapView.Active.GetSelectedStandaloneTables() https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/index.html#topic11959.html 

JohnPhillipsGeo
New Contributor III

Charles, 

Thank you for your reply.  That is exactly what we need!  By casting the active table's view model to a ITablePane and then getting its map member, we then gain access to the table's methods. 

ITablePane pane;
pane = (ITablePane)ProApp.Panes.ActivePane;
MapMember mm = pane.MapMember;


Thank you for your help.

JP