A Checked ListBox Gallery for the DevExpress Ribbon

An entry about user experience (ux) Publication date 6. June 2008 23:08

For a Windows Forms application we’re developing at work, we’re using the awesome suite of UI components from DevExpress, which among other things includes an Office 2007 style Ribbon. One thing I am sorely missing about the Ribbons API however, is extensibility. For example, for one Form I wanted to have a some kind of check box list inside a ribbon page group from which the user could select one or more items. The closest thing that the DevExpress Ribbon offers, is the Gallery control. However, it only allows you to create galleries that look like the ones in Office 2007 – for example the Style gallery…

Office 2007 Ribbon Gallery example

…while what I really wanted, was something like this:

Gallery with checkbox list

Not one to give up easily, I pushed and pulled at the Gallery control trying to find some way to customize it into what I wanted. In the end I came up with a work-around: Since each item in the gallery consists of a glyph (which is just an image) and a label, I could make the gallery look the way I wanted by rendering a custom Image that showed a checkbox (in either a checked or unchecked state) and text, and use these images as the glyphs for the items in the gallery. All I had to do then, was hook up an event handlers to the ItemClickEvent of the gallery, and swap out the glyph image of the clicked item with one containing either a checked or unchecked checkbox to simulate checking/unchecking an item. In the end, I ended up adding a bit more functionality (buttons for selecting/deselecting all items, grouping of selected items and a selection status icon) and wrapping it all up into a component that can be dropped onto a Form to convert any gallery into a checkbox list:

Designer support

Its difficult to explain the functionality in words or using static images, so here’s a short video of the custom gallery in action:

I’m quite pleased with how this turned out – now lets just hope the customers like it too :)

Source Code and Demo Project

If you want to have a closer look, then you can download the source code and a demo project here (Note that unless you have DevExpress XtraBars Suite 7.3 or later installed you won’t be able to compile or run the project). It’s a bit rough around the edges still, but it functions perfectly (as you can see in the video!) :)

Currently rated 5.0 by 3 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Comments

Powered by BlogEngine.NET 1.4.5.0

Welcome!

My name is Fredrik Kalseth, and this is my blog - thanks for visiting! I am fortunate enough to work with what I love for a living, and this blog is essentially the biproduct of that.

I work as a senior consultant for Capgemini, and am also an active participant in the Norwegian .NET community, as an avid attendee but also as a speaker (most recently at NNUG and MSDN Live).

As a developer, I have a wide circle of interest. My primary passion is for agile, test-driven development, with focus on best practices and clean code. That said, I also love to work on the frontend, especially with web development.

On Twitter? My handle is fkalseth. On LinkedIn? I`m there too.

NDC 2010

The conference to attend this summer happens June 16th-18th in Oslo, Norway. Are you going? Be sure to catch my talk on AOP while you're there!

 

Disclaimer

This is a personal blog; any opinions expressed here are my own and do not necessarily reflect those of my employer. All content herein is my own original creation, and as such is protected by copyright law. Unless otherwise stated, all source code posted on this blog is freely usable under the Microsoft Permissive License.

What Readers Talk About

Comment RSS