views:

221

answers:

1

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.

+1  A: 

Hi,

Having all views register in the same region (say "MenuRegion") is a good approach. As for checking for dirty views you might find this blog post from Brian Noyes useful:

I hope this helps.

Thanks, Damian

Damian Schenkelman
Not sure if your link answered his question, but it sure answered one of mine. Thanks!
Matt Jordan