Outlookbar event/command

Nov 7, 2008 at 6:40 PM
Edited Nov 8, 2008 at 5:47 PM
I'm curious if anyone has implemented the outlookbar as explained here:  http://blogs.southworks.net/ejadib/2008/07/22/use-the-outlookbar-in-your-compositewpf-prism-applications/ and has a technique to wire up an event handler to each outlookbar that is created.

Ezequiel apparently intends for the use of some OutlookBarEvent but I'm not sure how to utilize it.

I want to respond specifically to the selection of each bar.  Ideally, I could hook it up to a command object because I would like to enable or disable it using the CanExecute of a command.

Thanks.
Nov 8, 2008 at 3:58 PM
Upon further research into how events are to be utilized in the CAL, I subscribed to the OutlookBarEvent like this:

IEventAggregator
eventAggregator = RootContainer.Resolve<IEventAggregator>();
eventAggregator.GetEvent<
OutlookBarEvent>().Subscribe(BarClick, ThreadOption.UIThread);

However my handler never gets called.

So I looked into the contrib source code and set break points in the OnSelectionChanged method of the OutlookBarPublishBehavior class to find that that code never ran.

With further break points, I conclude that the AttachBehaviors(IRegion region, Selector regionTarget) method is also never called and so the event is never handled as intended.

Does anyone know the intent regarding RegionAdapters and use of this method (AttachBehaviors)?

Thank you.

 

Nov 8, 2008 at 9:06 PM
Edited Nov 8, 2008 at 9:07 PM
Ah ha! I have discovered that the problem is refered to in Julian's post here: http://blogs.southworks.net/jdominguez/2008/09/presentation-model-with-datatemplates-in-compositewpf-prism-sample/ where he mentions the loss of user interaction in the region when utilizing this technique.

I apparently need to implement an attached behavior to over come this.  When I do so I will post here about it.