Thursday, February 21, 2008

Silverlight and SharePoint, a beautiful marriage?

So after almost 2 months of silence I decided it’s time for some new postings. As you may know by now, I have been very busy with Sharepoint the last couple of months. Currently I’m creating a whole new Internet facing website as requested by my boss. Work is progressing, ok not that very fast, I’m still learning more of the sometimes mystical world of SharePoint every day (didn’t I use the word mystical in a previous post, well the word has its purpose, believe me).

So without any further ado, I created a SharePoint WebPart that will show an entire Picture Library in the form of a SilverLight slideshow. The WebPart is mainly based on a project called Silverlight Slideshow initiated by Koen Zwikstra from Firstfloorsoftware.com All I had to do add a little functionality and wrap the whole package into an WSP.
First problem I had to tackle was the logic needed to retrieve information from an SharePoint Picture Library and somehow inject this info into the slideshow.
The original program uses an XML file as its main source of information, making the world a little better place for me ;-)
I created a nice Handler that will do this for me and present the found information in a way the slideshow will “swallow”.
This handler will create the XML based on 3 properties of the library (Image, Thumbnail and Title).
By default there are a lot of configurable properties build into this great SilverLight control. I wrapped all these properties into the WebPart public properties, giving you the great power of controlling the presentation of the control without leaving your SharePoint GUI.
For example, you can turn on/off the buttons, thumbnail, tracker of just change the colors used to render it.
Ok well, how does this thing work in real life then….

All you have to do is:
1. Deploy the WSP to your Sharepoint site.
2. Activate the newly deployed feature in your Site Settings
SlideShow - Feature  
3. Add the WebPart to your site.
SlideShow - AddWebPart
4. Select the Picture Library for your image resource SlideShow - Properties
5. Change the properties of the WebPart to reflect your inner desires.
 
Volia, a fully functional slideshow on your page!
So, where can I download it you might wondering…
Before sharing the code with the community, I first have to check with the original creator of the Silverlight control and see if he’s ok with me releasing this as a WebPart.
For now you will have to do with a screenshot of the WebPart in action.
SlideShow - Preview

1 comment:

Unknown said...

Caching the XML output would be definitely a great improvement since you don't want the handler to process the same images on each request. Depending on how often the image's library gets updated, you could set the caching time quite high. A possibility to flush the cache would allow the editors to push their changes. :)