Tuesday, June 7, 2011

Prism 4 - Navigating to scoped regions, not quite.

I think many of us have been let down by the new version of PRISM...

The first thing that stands out in the new version is the Navigation API. When I first read it, it sounded brilliant. The idea and concept makes navigation in MVVM seems a breeze (previously resorting to IEventAggregator) so I was too quick to download the new build and tried it out. I also read Karl Shifflett's blog through and through and was ready to begin my first application using the new Navigation API.

The first thing you will notice is that its "relatively" simple to follow through and understand. I quickly got a working simple application using the new API. Notice how I used the word simple. This is exactly how it works with these frameworks. They are wonderful when you keep things simple, but when you start to get yourself in a pool of confidence and apply it to a new/existing projects, you get hit over the head with a sledge hammer.

The first issue I came across was nested regions. Previously, I never paid any heed to scoped regions, and each module was happy to set up its own region everything was fine. Now if you use the Navigation API, you will immediately notice that you application gets spoiled by the RegionCreationException.

What has happened is not clear until you scour the internet and find a few obscure blogs about nested regions and realized that the Navigation API is not quite there yet. There are a few missing pieces to make this whole thing play nice and some have resorted to forking the Prism project to cater for this error. My question is... 

"Why have you guys not seen this?!?"

This is again my point about these frameworks (*cough* practices *cough*) that comes up with something that would seemingly make your programming life heaven, and then hammer you down with issues such as the one I have mentioned. These guys love to keep things simple... but thats what they will ever be. Simple. Never quite ready for the real world.

1 comment:

  1. Ooooo. Deafening silence. Thanks for posting this. I'm just in the process of trying to figure out the same set of issues. Already using a mix of both EventAggregation and Navigation. The Navigation has been at the Shell level so I haven't hit the wall on it yet. But, I was about to try and replace EventAggregation in my scoped Regions. I won't waste the time now. Thanks again.

    ReplyDelete