Saturday, February 12, 2011

Pivot Viewer "Cricket World Cup 2011"

Hello friends,

we have left the last topic with definition of Pivot Viewer now in this post we are going to make a sample which use pivot viewer. Our sample is “Cricket World Cup 2011” so here we go
Step 1:- First checks on your machine following things are installed if not then please installed them
a) Silverlight 4 (http://silverlight.codeplex.com/ )
b) Pivot collection tool (http://www.silverlight.net/learn/pivotviewer/collection-tools/)

Step 2:- Once you have installed above tools then create a pivot collection first. The pivot collection can also be generate using code also (at run time) but here I am using excel pivot collection generator.
Step 3:- For generating collection just open excel book go to pivot collection menu when you click pivot collection just below the menu new pivot collection tools will be visible. Then just create new collection button as shown in above image.

Excel Pivot Collection
Step 4:- When you click the new collection button you will get new excel object as shown in below fig

Pivot Collection Template
Step 5:- Now add the data according to your need as I added following columns
a) Team
b) Name
c) Bating Style
d) Bowling style
e) Is Captain
f) 100’s
g) 50’s
h) Runs
I) Average
j) URL
k) Description
l) Image
Step 6: Just fill the data as per the filtration column as shown in below fig

Step 7: Now once your data is fill then just click on publish collection button on toolbar
It will generate a “CXML” file which is collection Xml file with

deep zoom images collection.

Step8:- Now your collection is ready so next thing is how to use it. So first create a VS2010 Silverlight web application project.

Step 9: Copy CXML & and images folder to your web project first
Step 10: Once you copied the CXML and Images then open your Silverlight project and drag drop Pivot control or if it is not exist in your tool manually add for that just add reference as shown below.
xmlns:pivot="clr-namespace:System.Windows.Pivot;assembly=System.Windows.Pivot"
Step 11:- Now in the code behind just assign the collection URL to pivot control. (The URL nothing but the CXML URL which you already copied in your web project in step 9) as shown below.
this.pivot.LoadCollection("http://localhost:54210/CricketWorldCup2011.cxml", "");
Step 12: Now run the project you will get following screen. On left side you will get filter criteria when you change t

hat your data will also change in centre.


Cricket World Cup 2011 Pivot
Hope the steps will be helpful and you can download code from.
Excel Data Cricket World Cup Team 2011 Data
Solution of Pivot Viewer Download Solution
Thanks & Esteemed Regards
Rajat Jaiswal