R – Silverlight 2.0 binding to images vs. Silverlight 3.0

data-bindingsilverlight

I have a Silverlight 2.0 application which binds a listbox to a collection of classes that contain a BitMap property (which are used for navigation). I've both included the images in the XAP as content and created the BitMap manually and set it as the controls source and I have also embedded the images as resources in the DLL and got the image from the manifestresourcestream and set the image. Both of these routes work great when the XAP is displayed using the Silverlight 2.0 plugin so I know my images are being deployed correctly. Unfortunately, when viewed on a machine with the Silverlight 3.0 plugin, neither of these methods display the images in the listbox.

Note that this problem only occurs when the binding takes place in an ItemTemplate of a Listbox. If I set the same property outside of the listbox it appears to find the images and work fine.

Any idea what has changed in ListBox binding between 2.0 and 3.0? I do have build 3.0.40307 of the Silverlight plugin on the machine I can reproduce the error on.

-Kevin

Best Answer

Ok...a solution was found (thanks to some help on the Silverlight boards):

First, it only works with the full release of the Silverlight 3.0 plug-in. Which poses a strange problem (described below).

Second, I had to switch from binding directly to an Image or Bitmap class and instead use an Imagesource class (which can be easily instantiated with a Bitmap passed to the constructor). Simple enough... Don't know why this is required in SL 3.0 but not 2.0 but it broke my code. My code is still written and compiled against the 2.0 plug-in but just runs in the 3.0 plug-in on computers that have it.

Which brings me to the strange issue...I have VM's or desktops with SL 2.0, SL 3.0 (Beta), and SL 3.0 (Full Release) available for testing. My plug-in now works fine in SL 2.0 and SL 3.0 (Full Release) but not in SL 3.0 (Beta). I get no warning and it opens fine, just that my images do not bind. So my concern is that a number of developer/techy oriented people will have the beta of 3.0 which still runs 2.0 plug-ins as it's backward compatible. They aren't forced to upgrade for any reason to run my site.

If you have any of these environments available here is a link to the site in question: http://stlouisdayofdotnet.com/DayOfDotnet.html

Related Topic