Hi All,
Recently we have seen lot of discussions/questions/articles/blogposts mentioning what is PRISM and MVVM and how to use it while creating your Silverlight applications. In this article series we will see a step by step process to create your project based on MVVM pattern using PRISMV2. But before we start let’s see what we are trying to achieve here.
We will create a simple Silverlight client which will take Blog url from user input and return all the posts of that blog to back to the user on Silverlight client. In following screen shot you can see the final behavior of our simple Silverlight client.

As you can see what it does is takes URL of a blog’s rss as string and returns all the entries of that RSS feed back to the Silverlight client in the Silverlight ItemsControl.
So let’s get started.
Step 1:-
The first thing you want to do is to create Silverlight project along with it’s web applications.

Step 2:-
Next step is to compile and add PRISM DLLs into your Silverlight applications. Make sure you have to use new release of PRISM in order for it to work with Silverlight 3. If you have any question/issues regarding this please follow this link. Making PRISM working with Silverlight 3.

Step 3:-
Now the next step is to add bootstrapper and shell into our Silverlight client as shown below. Remove all the xaml and relevant .cs files except App.xaml and it’s .cs from silverlight application and add a new user control named shell.xaml. Following screen shots will show how you Silverlight project after that.

Now what we want to do is to define a region into our shell. Adding namepsace and it’s declaration is defined as below.

Next step is to add bootstrapper as shown below into our application.

After adding this class modify it as below.

What we have done is registerd Shell as the root visual of our application and return the shell back. Also you can see we have created a dummy module catalog in later parts of this series we will modify it register proper moudle to be displayed on our shell.
Next step is to kickoff BootStrapper at the starting of our application. This has to be modified in App.Xaml.cs file shown as below.

With these things done we are alomost done with our plumbing work for PRISM and MVVM based application. Currently if you run the application it is not going to do anything but as I mnetioned the basic structure of the application is ready. In the next post we will see how to add WCF service into our application. With that post we will also add some basic infrastructure classes need to pass data back and forth from service to client and vice versa.
Thanks