can I add controls to dock pane in code?

1179
2
07-22-2021 01:20 PM
MichaelWen
New Contributor II

I'm trying to build an addin where a user can select features from a map layer and the attribute data associated with the selected features would be displayed in a textarea on the dock pane, with adjacent buttons to copy the content to clipboard. Our users need for each selected feature to have its own textarea/buttons so I can't just create them at design time.

In ArcGIS Desktop I can create new textboxes and buttons and add them to a FlowLayoutPanel, but I don't think that is available in Pro API. Can anyone help?

0 Kudos
2 Replies
John_Jones
New Contributor III

I suggest you look into ItemsControl in WPF to describe the basic process of adding a list of items to your UI surface. A tutorial introduction, such as this one... https://www.dotnetcurry.com/wpf/1160/wpf-itemscontrol-fundamentals-part1, may be helpful in getting started (many others available).  From a high level you set the ItemSource of the ItemsControl to be a Collection of items and you dynamically (at run time) fill in this list of these types (one per feature or whatever you want to show on the UI)  Then the ItemTemplate controls how each of these is rendered...

0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

There is a sample that is using a dockpane with a 'tab control' showing a table control for multiple feature layers:  arcgis-pro-sdk-community-samples/Map-Exploration/TableControlsDockpane at master · Esri/arcgis-pro-s...

I guess you would like to only show the actual selected items which is possible with minor modifications.

0 Kudos