OutlookBar 2.0 – from Winforms to WPF

If you work/ed with CAB and SCSF you might remember the Outlook Bar we created in 2006 with the initial input of Chris Holmes and the help of some of the Southworks guys like Mariano and Ezequiel. It turned out to be a popular control for composite applications since the nature of modules mapped quite well with the navigation bar buttons and the outlook navigation bar is a well known UX pattern for a fair amount of users.

We wanted to have this control for WPF apps and also have it integrated with CompositeWPF through a region adapter. The first version looks like this:

clip_image001

The trick is to overwrite the template of the TabControl and TabItem (WPF separates the behavior of the control from the visual layout and style), inherit from the SelectionRegionAdapter of CompositeWPF and adding a behavior that will publish an event with the EventAggregator subsytem on TabItem (navigation bar button) click.

We also created an attached property to separate the metadata containing the title and event payload from the region. In a future version this will also handle an icon associated to the button.

This is the current usage:

MyView view = new MyView();
OutlookBarControl.SetOutlookBarMetadata(view, new OutlookBarMetadata
    {
        Title = "Mail",
        Payload = "OnMailModuleActivate"
    });

IRegionManager regionManager = Container.Resolve<IRegionManager>(); 
regionManager.Regions[RegionNames.OutlookBarRegion].Add(view);
regionManager.Regions[RegionNames.OutlookBarRegion].Activate(view);

I would like to see a simpler API, specially for associating the metadata, but this is a start.

Read more about the implementation in Ezequiel’s post and download the code from the contrib site.

blog comments powered by Disqus