I’m looking to implement a Visual Studio-style undo drop-down button:

I’ve looked all over the internet, and can’t seem to find any real implementations of this.
I’ve started by deriving from ToolStripSplitButton, but don’t really know where to go from there. Its DropDown property is a ToolStripDropDown, but that doesn’t seem to have anything regarding multiple items being selected, much less scrolling, and the text at the bottom.
So instead of the default ToolStripDropDown, I’m thinking maybe the whole drop down part should be a custom control, based on a combobox. The question then, is how to cause the right-side (drop down arrow) button to do something other than show its default drop down?
Am I on the right track here? Thanks!
Yes, I think you’re on the right track. And in this case,
ToolStripControlHostis your friend.You don’t necessarily need to derive from it (unless you are making your own control), but try just subscribing to the
ToolStripSplitButton'sDropDownOpeningevent:Working example:
Here is the result:
For your application, you would need to replace the
ListBoxwith your ownUserControl, so you can contain whatever your want in it. TheToolStripControlHostcan only hold one control, and it’s important to set theMinimumSizeproperty, or else the dropped control isn’t sized correctly.