tags:

views:

1231

answers:

4
+3  Q: 

WPF SplitButton?

I've just spent a very frustrating afternoon trolling Google looking for a commercial-grade WPF SplitButton control that will work in a toolbar. A SplitButton is one where you can click on the main part of the button to take a default action, or click on a little triangle on the right to get a drop-down menu of alternate actions).

I found several on the web (including the one on CodeProject, and including the two on CodePlex). None of them work properly in a toolbar--they either don't appear at all, or they don't have toolbar button styling. I even looked at some commercial offerings, like ActiPro's pop-up button (in their SharedLibrary DLL). Same problems.

And yes, I've seen all the posts about how easy it is to create one. It's very easy to create a bad one, but not so easy to create one that looks and works like the SplitButtons in Outlook or Visual Studio, where the drop-down menu doesn't disappear if you release the mouse button.

So, here's my question: Are there any commercial-grade SplitButtons out there, either open-source or commercial, that work in toolbars? I'm not looking for a control that is part of a $1,500 annual subscription to somebody's controls library, but if there is a reasonably-priced SplitButton, I'd sure like to find it.

Thanks for your help

+1  A: 

The only true "commercial-grade" split button that I know of is the one by Syncfusion, which is included as part of their ribbon controls (although it works outside of the ribbon as well).

That being said, I remember this implementation as being fairly usable and complete, if you're looking for something free.

Reed Copsey
Yeah, I came across Zhou Yong's implementation in my initial search. Unfortunately, the source code link is broken.
David Veeneman
Update: I looked again at Zhou Yong's blog and fond a comment where someone said they found the source code on Channel9. Found it here: http://channel9.msdn.com/playground/Sandbox/244830-SplitButton/
David Veeneman
+1  A: 

I don't know what exactly you are looking for in a split button, but this video on how to create one is pretty complete and makes a splitbutton that is just about perfect.

http://windowsclient.net/learn/video.aspx?v=3929

I know you didn't want a tutorial, but I've used this before and you couldn't tell the difference between it and the ones in outlook.

Anderson Imes
That link doesn't work any more. Lee Brimelow seems to have vanished, which is a shame. I saw the video referenced several times when I was searching for a button, and apparently the tutorial is quite good. If you come across a working link, please let me know. Thanks.
David Veeneman
Ah bummer you are right. What a shame - it was a good presentation.
Anderson Imes
I've contacted him about the video. He appears to work for Adobe now... hopefully he'll be willing to share those videos again.
Anderson Imes
Thanks for the follow-up Anderson--much appreciated. I upvoted your response.
David Veeneman
A: 

I think what you mean is called a DropDownButton. There is a boolean property on MenuItem "StaysOpenOnClick" which could solve your problem.

codymanix
Why -1? was something wrong I said?
codymanix
I didn't put in the downvote, but I think you may have misunderstood the question. A DropDown Button drops its menu no matter where it is clicked. A SplitButton has two regions; a main region and a drop-down region. If you click on the main region, the button takes a default action. If you click on the drop-down region, it drops its menu. If you look at the 'New Project' button on the VS 2008 Main toolbar, you will see an example of a SplitButton.
David Veeneman
+1  A: 

Another good free implementation that seem to have it all:

http://huydinhpham.blogspot.com/2008/09/wpf-drop-down-and-split-button.html

  • The split button can be used in the toolbar and has a proper toolbar style. It can also be restyled if you want.
  • Dropdown menu is exposed via its own property - i.e splitbutton can have it's own context menu separate from the dropdown one (even though it seems illogical it can be useful in some cases - like toolbar context menu that pops up when you right click on a button placed in the toolbar).
  • The dropdown menu is standard ContextMenu - i.e. content can be databound, menu items restyled etc.
  • Both the main and the dropdown parts of the split button have command properties associated with them.
Alex_P
Thanks for the link--I upvoted your response
David Veeneman