Best Practice for Shell Layout and Switching Views - Prism, SL4, On Demand Load Modules

Posted by kmacmahon on Stack Overflow See other posts from Stack Overflow or by kmacmahon
Published on 2010-03-20T21:49:32Z Indexed on 2010/03/20 21:51 UTC
Read the original article Hit count: 493

Filed under:
|
|

I am learning Prism, and I have a question on the best approach for the main Shell.

Assuming the Shell has 2 regions: Toolbar, Main. The toolbar has 3 main buttons that each represent a different On Demand Load Module. Each of these modules currently register themselves as fitting in the Main Region.

When I click one of the buttons I want to do the following:

Notify any active view that its switching, with an option to cancel if there is a pending action still required. This might cascade to child views.

If the action isn't cancelled then load the on demand module if it has not yet been loaded, else activate it within the region.

Should these three modules all fit in the same Region or should my shell have 3 regions defined within content presenters?

One of the areas I got stuck on was that when you register a view from the Module Initialize, it doesn't get added with a strongly typed name, so when I tried to determine if my view was already added to the region with GetView(viewname) it always returns null, so I end up adding another view to the region.

© Stack Overflow or respective owner

Related posts about silverlight-4.0

Related posts about prism