Saturday, July 17, 2010

Customize Silverlight toolkit navigation application project template


To get the Silverlight Navigation Application Template install the latest version of Silverlight toolkit

Now lets create a Silverlight project using the navigation application template:

You can customize the default layout as required. In this sample I have used a Datagrid to get my desired layout like below. You need to modify some of the style in App.xaml.

Download the source here.
Check the demo below:



Thursday, July 8, 2010

Reusable Silverlight service project to avoid multiple addition on same WCF services reference

Inspiration of this post: http://forums.silverlight.net/forums/t/190515.aspx

We can create a reusable  Silverlight service project so that it can be used by different Silverlight application and service reference update will be restricted on a single place.

Suppose we have two Silverlight application that will use the common service:
1. SLProject1
2. SLProject2

Lets create a common service project:
Add new project of type 'Silverlight Class Library' suppose name is MyCommonWCFService like below:


In the MyCommonWCFService project add the service reference like below:


Now in your SLProject1 and SLProject2:
Add MyCommonWCFService project reference like below:


And also add the reference of System.ServiceModel:


Now copy the ServiceReferences.ClientConfig from the MyCommonWCFService project and add as existing item to the SLProject1 and SLProject2.

Example solution explorer will be like below:

Suppose we have a WCF service like below:


You can consume the common service client in SLProject1 or SLProject2 like below:




You can download the sample example.