Can you create a multi-level dropdown button to organize and select features?

1191
11
10-27-2020 12:27 PM
DerekSalinas
New Contributor III

Hello All,

Within ArcMap, we could create a custom button, via python, to act as an organized catalog to add features to a map from a geodatabase. All the menu items were neatly organized depending on the category of the feature. This was a nice way to present the data because there is a lot to organize. In addition it would call up the feature class from a geodatabase and utilize the symbology from a specified layer.  

Original Addin

Now i have created a very basic button in ArcPro to call up features from a specified geodatabase, however i can't find any information on how to organize the buttons into further dropdown categories or utilize layer symbology. 

 \

Any help on code or a point in the right direction would be incredibly helpful and I appreciate your time. 

Thanks,

Derek Salinas

0 Kudos
11 Replies
GintautasKmieliauskas
Regular Contributor

Hi Derek,

If your structure is always the same you can define it in config.daml splitbuttons section. More info here:

ProGuide Palettes and Split Buttons · Esri/arcgis-pro-sdk Wiki · GitHub 

DerekSalinas
New Contributor III

Good Morning Gintautas,

Thanks for your timely reply. It was very helpful for a base case addin. Im curious, if i had too many button elements in a split button and they needed further organization, is there a way I can "subgroup" a list of split buttons in an existing split button? Would that just require inserting split buttons in the parent? 

Regards,


Derek

0 Kudos
UmaHarano
Esri Regular Contributor

Along with split buttons, another way you can organize multiple buttons/tools is to use "galleries".

Here are a couple of samples and screenshots of galleries you can create with Pro SDK:

1. OpenItemDialogBrowseFilter sample creates this gallery

UI

2. Couple of Framework Gallery samples: Gallery   Configure Gallery

3. ProGuide: Gallery

Thanks

Uma

DerekSalinas
New Contributor III

Thanks for the suggestions Uma! Although I think with the amount of data that there is to organize and the subcategories needed a simple menu structure like the previous ArcMap python example i have above  would be best. Galleries just seem too invasive from a UX standpoint. 

Currently I just have the simple button pallet with drop down that contains a few feature class buttons. I read somewhere that it is not possible to contain several button_pallets or splits within one but im hoping that is wrong. 

0 Kudos
GintautasKmieliauskas
Regular Contributor

Hi Derek,

I thought that we can add spiltbutton to another splitbutton. But it impossible now. I have made test. So better solution would be customControl where inside you have wpf tree or bunch of expanders with styled lists of buttons. Then you can manage them on fly depending on your situation. This is more advanced way which requires more WPF knowledge.

Custom control sample you can find: arcgis-pro-sdk-community-samples-master\Framework\RibbonControls

It is not what you exactly need but you can find how to add custom control to ribbon and how it works with mvvm.

DerekSalinas
New Contributor III

Good Morning Gintautas,

Its strange though, there is a section in the 'Insert' Tab that makes me think you can do a split button in a split button. Within 'Insert,' you will see the button 'Task' in the 'Projects' group is a split button that drops down to a regular button and another split button. I'm just not sure how to organize that properly within the code. 

0 Kudos
GintautasKmieliauskas
Regular Contributor

Hi Derek,

Intellisense wrotes what elements of splitbutton can be button, gallery, or customcontrol. So your next level item must be customcontrol which acts as splitbutton.

It would be nice if Esri would implemented possibility to add splitbutton to splitbutton.

Maybe it is enough for Esri to expose existing their solution (you found) to public

But you can search internet for free or commercial wpf splitbutton and add it inside your customcontrol.

0 Kudos
NarelleChedzey
Esri Contributor

Derek, 

The Task button/dropdown that you reference above is achieved using the daml menu structure.   Here is the code

<menus>
<menu id="esri_task_insertMenu" caption="Task" extendedCaption="Ribbon add task items menu" keytip="TA"
largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/TaskItem32.png"
smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/TaskItem16.png">
<tooltip heading="Task">Add task items to your project.</tooltip>
<button refID="esri_tasks_NewProjectTaskItem" />
<menu refID="esri_tasks_ImportTaskFileMenu"/>
</menu>
<menu id="esri_tasks_ImportTaskFileMenu" caption="Import and Open Task File"
largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericImport32.png"
smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericImport16.png">
<button refID="esri_tasks_ImportTaskFileBrowse"/>
<dynamicMenu refID="esri_tasks_ImportMenu" inline="true"/>
</menu>
</menus>

The dynamicMenu can be replaced by other button references. 

The "esri_task_insertMenu" is inserted into a group as a buttonPalettte item

<group id="test" caption="Test">
<insertButtonPalette refID="esri_task_insertMenu" size="middle"/>
</group>

Hope this helps. 

Narelle

DerekSalinas
New Contributor III

Awesome Narelle! 

Thanks so much for getting me this! I did have a couple questions though. In your "group" section, you have "insertButtonPallet" as the call but im pretty sure it is supposed to be "buttonPallet", correct? 

Also,  the path for the menu goes to a slightly different item than the rest of your menus (task & tasks), and im wondering if you have to add the detail for the buttonPallet you insert in the groups into a different item?

Forgive me for my crap nomenclature, I hope im conveying my questions adequately.

Thanks!

Derek 

0 Kudos