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!
Solved! Go to Solution.
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
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
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