Question

Is it possible to implement a button, which opens a menu on it? I need something like button style combobox or a dropdown button.

Was it helpful?

Solution

Absent a mock-up image or a little better explanation, I'm not sure if I completely understand what the element that you're trying to create looks like and how it should work. Mostly, I just don't understand what a "button style combobox" is. That being said...

I suggest taking a careful look at wyDay's SplitButton control. It's free and open source, and allows you to add a context menu to your button that drops down whenever the button is clicked.
Plus, I feel like the other advantage to using something like this is that it replicates a common UI element. Lots of Microsoft's own software, and plenty of that available from other developers as well, uses a similarly-styled control. Things like this make it likely that your users will immediately grasp how to use it.

     SplitButton demonstration

Because I'm obsessively picky, I've implemented my own custom drop-down button control using this as a model, but it should work fine for 99% of applications right out of the box. So in the event that you're looking for something extra, it's trivial to add it onto the existing base control.

OTHER TIPS

The standard .NET ToolStripSplitButton control works like this. You have to put it on a ToolStrip. You could undock the strip and set its GripStyle to Hidden to make it resemble a regular button.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top