CAB: Use the Outlook Bar in your CAB applications

UPDATE: I moved the code to codeplex. http://www.codeplex.com/cabextensions.

----------

A frecuently requested feature in the CAB community is a navigation control like Microsoft Outlook’s bar. Chris Holmes posted a few days ago a nice approach on how to achieve this using CAB:

cab1

In CAB Reference Implementation 2 (Global Bank Branch WorkBench), an IconTabWorkspace is introduced. The functionallity of the workspace is similar to Outlook's bar, but it just displays icons (ToolStripButtons):
cab2

At Southworks, we liked both ideas and put them together to create an OutlookBarWorkSpace:

cab3 cab4
OutlookBar workspace showing the Mails smartpart Calendar module was selected and the smartpart has been shown
cab5
cab6
Use of the splitter Show more/fewer buttons

You can download it from here.

Usage

Use it as every CAB Workspace! Add SmartParts using:

  • void Show(object smartPart) and having your SmartPart implement ISmartInfoProvider or 
  • void Show(object smartPart, ISmartPartInfo smartPartInfo)

But take into account that in both cases you have to provide an OutlookBarSmartPartInfo, which will contain needed information to create the buttons.
OutlookBarSmartPartInfo has the following members in addition to those included in the SmartPartInfo base class:

  • Icon: bitmap to be displayed in the button.
  • (Optional) ImageTransparentColor: transparent color on the item's icon for images that support transparency
  • (Optional) EventTopicName: EventTopic that will be raised when clicking the button. This is useful, for example, when you need to update another workspace (much like what MS Outlook does).

Apart from these members, the OutlookBarWorkspace uses the Title property to set the button's text.

Disclaimer:
This code is provided "AS IS" with no warranties, and confers no rights.

Acknowledgments
- The implementation of the stack strip is based on a sample written by Joe Stegman
- Mariano Szklanny helped writing the workspace implementation
- The office icons might be used only if you have a valid Microsoft Office license

Published: May 01 2006

blog comments powered by Disqus