Sunday, July 10, 2011

Accordion Control for WPF

Few days ago I was looking for the accordion control available in WPF for once of my requirement.
I have to show a Hierarchical object to the user, but the content of the accordion should change based on whether there is multiple object in second level or not. So if there are multiple objects in 2nd level I have to show it in Tab control while if there is single object I have to show it in Listview.

After some googling I figure out there are 3 possible options for that.
  1. Use toolkit Accordion Control.
  2. Make your own accordion.
  3. Use ComponentOne Accordion. 


Option 1 (ToolKit):
Pros:
  1.  Easy to use .
  2. Licensing cost.
  3. Can be configured to cater your need.
  4. You can data bind to the control.
Cons:
  1. Still in preview phase.
  2.  Lots of small defects (Like being a ItemControl it don’t support ItemTemplate). 


Option 2 (Custom Control):
You can use wpf treeview to behave like an accordion control.
Pros:
  1. Highly customizable to your needs.
  2.  Highly reliable unlike toolkit where u can find defect now & then.
  3. You can databind it.
  4. No Licensing cost.

Cons:
  1. You need to make your hands dirty (But that’s the best thing a developer wantsJ).
  2.  It’s difficult to match the flexibility of toolkit accordion (you can change the orientation etc.).


Option 3 (ComponentOne Accordion)
ComponentOne provide a wpf accordion control. But this control is made on top on WPF toolkit accordion so behaves like same except CopmponentOne provides support & a nice look to toolkit accordion.

Pros:
  1. A production ready control with nice template.
  2. Can be used with wpf databinding.
  3. Support from ComponentOne Team.

Cons:
  1.  Licensing Cost.
  2. As build on top of toolkit accordion so expect the same non uniform behavior (as I mentioned above no ItemTemplate support even it is ItemControl). 
(In my view why someone wants to pay for this control if it is made on top of toolkit accordionJ)

Complete solution is at 

It contains detail solution for all the 3 options above mentioned.

Please feel free to ask any question via comments. If you like this posting please follow my blog.

No comments:

Post a Comment