Public Shared ReadOnly Property Panes As PaneCollection
public static PaneCollection Panes {get;}
Public Shared ReadOnly Property Panes As PaneCollection
public static PaneCollection Panes {get;}
{
List<uint> myPaneInstanceIDs = [];
foreach (Pane p in FrameworkApplication.Panes)
{
if (p.ContentID == paneID)
{
myPaneInstanceIDs.Add(p.InstanceID); //InstanceID of your pane, could be multiple, so build the collection
}
}
foreach (var instanceID in myPaneInstanceIDs) //close each of "your" panes.
{
FrameworkApplication.Panes.ClosePane(instanceID);
}
}
{
var mapPanes = FrameworkApplication.Panes.OfType<IMapPane>();
foreach (Pane p in mapPanes.Cast<Pane>())
{
if (p.Caption == paneID)
{
p.Activate();
break;
}
}
}
{
string mapPaneCaption = "USNationalParks";
IMapPane mapViewPane = FrameworkApplication.Panes.OfType<IMapPane>().FirstOrDefault((p) => p.Caption == mapPaneCaption);
mapView = null;
if (mapViewPane != null)
{
// activate the MapPane
(mapViewPane as Pane).Activate();
if (mapView != null)
{
// get the layers selected in the map's TOC
var selectedLayers = mapView.GetSelectedLayers();
}
}
}
{
// find all the table panes (table panes hosting map data)
var tablePanes = FrameworkApplication.Panes.OfType<ITablePane>();
var tablePane = tablePanes.FirstOrDefault(p => p is ITablePaneEx { Caption: "oldCaption" });
if (tablePane is ITablePaneEx tablePaneEx)
tablePaneEx.Caption = "newCaption";
// find all the external table panes (table panes hosting external data)
var externalPanes = FrameworkApplication.Panes.OfType<IExternalTablePane>();
var externalTablePane = externalPanes.FirstOrDefault(p => p.Caption == "oldCaption");
if (externalTablePane != null)
externalTablePane.Caption = "newCaption";
}
{
// find all the table panes (table panes hosting map data)
var tablePanes = FrameworkApplication.Panes.OfType<ITablePane>();
var tablePane = tablePanes.FirstOrDefault(p => p is ITablePaneEx { Caption: "caption" });
if (tablePane is ITablePaneEx tablePaneEx)
tableView = tablePaneEx.TableView;
// if it's not found, maybe it's an external table pane
if (tableView == null)
{
// find all the external table panes (table panes hosting external data)
var externalPanes = FrameworkApplication.Panes.OfType<IExternalTablePane>();
var externalTablePane = externalPanes.FirstOrDefault(p => p.Caption == "caption");
if (externalTablePane != null)
tableView = externalTablePane.TableView;
}
}
{
//Activate an already open layout view.
//A layout view may be open but it may not be active.
//Find the pane that references the layout and activate it.
//Note - there can be multiple panes referencing the same layout.
foreach (var pane in ProApp.Panes)
{
var layoutPane = pane as ILayoutPane;
if (layoutPane == null) //if not a layout view, continue to the next pane
continue;
if (layoutPane.LayoutView.Layout == layout) //activate the view
{
(layoutPane as Pane).Activate();
return;
}
}
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)