{
//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;
}
}
}
{
//Set the active layout view's selection to include 2 rectangle elements.
//Reference the active view
LayoutView activeLayoutView = LayoutView.Active;
if (activeLayoutView != null)
{
await QueuedTask.Run(() =>
{
//Reference the layout
Layout lyt = activeLayoutView.Layout;
//Reference the two rectangle elements
Element rec = lyt.FindElement("Rectangle");
Element rec2 = lyt.FindElement("Rectangle 2");
//Construct a list and add the elements
List<Element> elmList = new List<Element>
{
rec,
rec2
};
//Set the selection
activeLayoutView.SelectElements(elmList);
});
}
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)