Create split view of two panes with a button

765
6
Jump to solution
05-24-2022 02:54 AM
BartQuainkCGI
New Contributor II

I want to be able to create a button that opens up two panes split as shown in the image below.

 

Currently, I use the following:

 

protected override async void OnClick()
        {
            Map map = null;
            Map schema = null;

            var mapProjectItems = Project.Current.GetItems<MapProjectItem>();
            await QueuedTask.Run(() =>
            {
                if (mapProjectItems.Count() > 0)
                {
                    var mapProjectItem = mapProjectItems.First();
                    var schemaProjectItem = mapProjectItems.Last();

                    map = mapProjectItem.GetMap();
                    ProApp.Panes.CreateMapPaneAsync(map);

                    schema = schemaProjectItem.GetMap();
                    ProApp.Panes.CreateMapPaneAsync(schema);
                }
                else
                {
                    map = MapFactory.Instance.CreateMap("Local Map", MapType.Map, MapViewingMode.Map, Basemap.Terrain);
                    schema = MapFactory.Instance.CreateMap("Schema", MapType.Map, MapViewingMode.Map, Basemap.None);
                }
            });

        }

 

But this opens two maps in two different views. How would I make it so it creates the two maps split horizontally or vertically as shown in the image?

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
CharlesMacleod
Esri Regular Contributor

Yes, I see your confusion - presumably this sentence? "You can open many panes at the same time, and they can be grouped, tiled (horizontally or vertically), or floated."....

We will change it to "You can open many panes at the same time, and they can be grouped, tiled (horizontally or vertically), or floated - but only interactively" for the next release.

 

 

 

View solution in original post

0 Kudos
6 Replies
CharlesMacleod
Esri Regular Contributor

there are a number of different ways to can open panes - map panes in your case -

var mapItem = Project.Current.GetItems<MapProjectItem>().First();
//ok to call on the UI
mapItem.OpenMapPaneAsync(MapViewingMode.Map);

QueuedTask.Run(()=> {
 //GetMap needs the QTR but OpenViewAsync does not
mapItem.GetMap().OpenViewAsync();

//assuming u have a map - ok to call on the UI
FrameworkApplication.Panes.CreateMapPaneAsync(map);

 

However u cannot control their placement. However, if you open a view for a map that was previously opened (in the project in the session) then the pane will go back to the configuration it was last in

0 Kudos
BartQuainkCGI
New Contributor II

It does seem it's possible to control placement, as described here in the #pane section . Although it is not described how exactly.

0 Kudos
GKmieliauskas
Esri Regular Contributor

Hi,

You could use code below to get all MapPanes:

                IEnumerable<IMapPane> mapPanes = FrameworkApplication.Panes.OfType<IMapPane>();
                foreach (var mapPane in mapPanes)
                {

                }
0 Kudos
BartQuainkCGI
New Contributor II

It seems to be possible as described here : https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Framework#pane although it is not explained how to do this exactly.

0 Kudos
CharlesMacleod
Esri Regular Contributor

Yes, I see your confusion - presumably this sentence? "You can open many panes at the same time, and they can be grouped, tiled (horizontally or vertically), or floated."....

We will change it to "You can open many panes at the same time, and they can be grouped, tiled (horizontally or vertically), or floated - but only interactively" for the next release.

 

 

 

0 Kudos
BartQuainkCGI
New Contributor II

Yes that's my confusion, the "can be grouped" part made me think it was possible to do it automatically. Too bad it's not possible then!

0 Kudos