Kevin, hopefully this isn't too little too late for you, but here's what you actually need to do.Go back to using the standard add-in toolbar setup. (Unless there's some other reason to create your own that you didn't mention. This will still work with that as well, it's just easier to work with the Config.esriaddinx setup than defining custom classes, IMHO.) Then add a Menu to the Toolbar. Then add a new Add-in Component and select Multi-Item. Fill in the details about your Multi-Item (it doesn't really make much difference as far as I've been able to tell what you put there, but just in case...) and then add it to your Menu.Finally, open the .cs/.vb file and you'll need to override two methods: (the project that I used this method on was written in VB.Net, so I'll just use that for my examples even though I've grown more fond of C#...)Protected Overrides Sub OnPopup(ByVal items As ESRI.ArcGIS.Desktop.AddIns.MultiItem.ItemCollection)
andProtected Overrides Sub OnClick(ByVal item As ESRI.ArcGIS.Desktop.AddIns.MultiItem.Item)
OnPopup happens when your Menu is opened and what it's expecting you to do is add Items to the ItemCollection that is passed in. The Item class is very simple and provides things similar to a Command. But you don't need to subclass it and you probably don't need to worry about setting anything other than the Caption. In my code, I have each of my possible Items defined as private members and I just add the ones I need, depending on certain conditions, in the call to OnPopup. Then in the OnClick call, I check to see which one of my Items was returned to me as the one that was clicked and do whatever needs to be done based on that.In your case, it sounds like the Items are essentially populated using your file structure. In that case, you might want to have some other piece of information in addition to the Caption, like the full path as opposed to a more friendly version of the file name. So let me give a quick example of what you could do:
Protected Overrides Sub OnPopup(ByVal items As ItemCollection)
Dim files As List(Of System.IO.FileInfo) = 'Some method that returns a collection of FileInfo objects in the desired path(s)
For Each file In files
items.Add(New Item With {.Caption = file.Name, .Tag = file.FullName})
Next
End Sub
Protected Overrides Sub OnClick(ByVal item As Item)
Dim file As New System.IO.FileInfo(item.Tag)
'Code to open the file and do something with it
End Sub
The possibilities of what you want to do with it from there are nearly endless. You can then have as many or as few items show up as you want (I think), but I would suggest you do something to keep it from being several hundred items all at once... 😉Hope that helps you and/or someone else! 🙂