Should create a Module for menus/toolbars/etc?

Nov 29, 2008 at 9:51 PM
I wanted to see if things like menus, toolbars etc should be added directly to the shell, or if these should be part of a "main view". In that main view would be regions for other views to plug into.

 In other words, the only thing that would be in the shell would be resouces, and one Grid with one ContentControl (with a region mapping). The ContentControl would serve as the placeholder that the "main view" would plug into.

Perhaps there's no reason to do this as I guess that the menu items and toolbar items would probably just be tied to commands via CompositeCommand references, but I just wanted to put the thought out there to see if other people have been doing this, or if the standard technique is just to put these directly into the shell.
Nov 30, 2008 at 5:03 PM
Edited Nov 30, 2008 at 6:43 PM

Kona,

This is dependent of your requirements or where you want to implement it. If I understood correctly you are questioning if Menu or Toolbar should be implemented in the shell or in single “Main View”, in this context I don’t see any difference as I would implement it as a module, and placeholder would determine where it would live.

To expand this a bit and consider the following:

If I can unify the menus and toolbars of all views. I would implement these as a module and place it either to Shell or Main View. 

If I would end up on above, I would create a standardized New Menu action(s). Once the view would be loaded and be activated, it would fire-up an event from view/presenter which would enable and show the menu action(s) that are valid. I could also fire up an event to change the menu action text or toolbar icon for more specific based on the active view. For example “New Customer Address” when customer details view is active and is possible action in the context of view.

This above approach is not always feasible in RIA type of application, as one menu structure or graphical design of it can be a very different from one view to another. Also consider if you have a placeholder that can be presented in multiple locations, like Disclaimer action on web page implementations. I would not create two different implementations of this Disclaimer or menu action but rather one View/module that would activate the menu on shell or main view if the placeholder is in place or configured.

Hope above helps you…

Regards,
Alexander

Dec 7, 2008 at 2:25 PM
alexanderqx,
   thanks for the reply. This definitely does help. I'm familiar with concept of extending the menu for specific modules from CAB via UIExtensionSites, but know that Prism doesn't really have this concept. Is this something that is going to be coming down the road, or does it not really fit into the Prism architecture?
   I was wondering if anyone knows of any samples that have menus / toolbars in them.
   I think it would help me solidify it in my mind if I was able to go through a sample.

Thanks again,

Jeff
Dec 7, 2008 at 5:17 PM
Jeff,

Take a look of CodeDrop 7 sample for commanding (OrdersToolbar), which is located at \Quickstarts\Commanding folder. This sample is not fully completed yet according to release notes but will probably give you a good start.

Regards,
Alexander

Jan 11, 2009 at 4:41 PM
Hi there,

I actually had a look at commanding quick start sample and figured out that currently it does the simple thing: having named region on a shell (GlobalCommandsRegion) it adds there a toolbar (OrdersToolbar) defined within OrderModule. There is no way to extend the toolbar itself adding new buttons in.

Thanks,
Leonid
Jan 12, 2009 at 1:18 PM
Edited Jan 12, 2009 at 2:55 PM

In case it's of interest, the composite wpf contrib project has a toolbar panel region adaptor that allows dynamic additions of controls to a toolbar, not sure how well it works in a dynamic setting but we have used it with a set number of controls on, it seems to have an issue with styling but there is a workaround..

regards

Trev