A hobby project I have been working on, to clear my mind of the daily grind, is a Control that lets a developer host a Silverlight application to WPF.
A good kept secret is there is complete COM API for hosting Silverlight outside the browser. There is even sample C++ code here. The problem I found with all of these was everything assumed you are rendering to Win32/Windowed. This is not the kind of thing we want in a WPF application. Airspace restrictions are for weenies.
I had remembered that Silverlight DOES infact support windowless. That given, I wrote a host in C# to load Silverlight windowless and had it render to my own GDI bitmap, instead of the screen. That worked well, but CPU usage was high and I didn’t get any alpha transparency. After some more research I found that the native SDK supports rendering to an ARGB buffer! After some more nasty, dirty native interop, I got it working with alpha transparency…and performance was much better.
I did start out using the WriteableBitmap, but eventually moved over to use InteropBitmap and performance got even better!
Anyways, there’s still a lot of work to be done, but I’m excited enough about it to show it off now.
Try it out at: http://silverlightviewport.codeplex.com
Update: I also want to thank Koen Zwikstra, for his project helped me prototype the original code. I’ve since rewrote everything, but you may find some things similar. This is why ;)