Well that’s a long title but I think you get the idea of what this post is about.

Building on top of my web part template I thought I ought to do something useful that I could share. So Combining the ability to peruse lists from a webpart and mangling this into Silverlight I made a webpart Image Library viewer.

Now this is pretty rough and ready the xaml is from the VB school of design, “Grey Blue and Boxy”, but get a designer on the case and your away.  It contains elements of a jscript Control.  The photos at the bottom scroll left and right and are added dynamically.  This is a good use of the CreateFromXaml but using the “true” option for the namespace scope, which is better than find and replace of the video library example.  It does full screen by clicking the little grey blue square (see what I mean about design) which is taken from the video library sample and doesn’t scale to exactly 4:3, again I don’t have time to investigate, it involves pencils and math’s and I’m a bit busy.

The webpart itself looks specifically for a list called “Image Library” one of the default lists created by portal sites.  This can be changed so that you could have a toolpart selection.  It relies on the list being an Image Library list.  If the list is not there it blows up I haven’t spent long on this making it bomb proof.

If there are no pictures in the image library it resorts to displaying text in the webpart that the list is empty, not some custom display in the Silverlight part.

I think this is a good example of what can be created with very simple xaml, certainly better xaml than the video library which is all over the place (if you look at this, its offset for a start, making all the jscript fudges hard to understand).  It has the rudiments of a control.  It has scaling, clipping, timers, events.  The thing that muddies it a little is the Sharepoint bit, but a quick view source and save as HTML should work nicely there.

Update : StandAlone not sharepoint project to help design it  – Demo

Update 2 :  ** RC1 Source Code **


  • Built on x64 platform (change your references)
  • Built for Sharepoint 2003
  • Uses Dummy SNK replace with your own (you dont have to but its wise)
  • Designed with Sharepoint trust  level set at full

Areas for Improvement:

  • Range Checking number of images
  • Design!
  • Move into view animation of selection bar
  • better resize
  • Selectable Image library
  • Checking of list conforms to type image library
  • Downloading of thumbnails restricted to those in view and n+ more as you scroll into view it downloads as it needs
  • Freeing of memory after building control
  • Transistions on photos
  • DblClick big photo to Zoom Full screen
  • Option to use hi-res version of photos and appropriate download “waiting” icon when selected
  • and a lot more I haven’t thought of yet

Again Feel free to use and change this but attribute original work to me please.  Also Comment if you like it or not.

(PS I’m moving ISP’s 12th June 07 so if this stops working early sorry, I will be migrating sources to new ISP when I have access).

Technorati tags: , ,