I have a list of layouts and want to be able to set one of them as the active view in Pro SDK
Thank you Jeff!
Please check out Layout snippets 2-4: https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Layouts
Here is a code snippet of mine that looks for all possibilities (examples above combined):
//Check to see if the layout already exists LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals("Game Board")); if (layoutItem != null) { Layout lyt = await QueuedTask.Run(() => layoutItem.GetLayout()); //Next check to see if a layout view is already open that referencs the Game Board layout foreach (var pane in ProApp.Panes) { var lytPane = pane as ILayoutPane; if (lytPane == null) //if not a layout view, continue to the next pane continue; if (lytPane.LayoutView.Layout == lyt) //if there is a match, activate the view { (lytPane as Pane).Activate(); System.Windows.MessageBox.Show("Activating existing pane"); return; } }
//If panes don't exist, then open a new pane await ProApp.Panes.CreateLayoutPaneAsync(lyt); System.Windows.MessageBox.Show("Opening already existing layout"); return; }
//The layout does not exist so create a new one Layout layout = await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run<Layout>(() => { //*** CREATE A NEW LAYOUT ***
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.