none
Hosting Silverlight control in a rich client application.

    Question

  • Hello,


    Is there news concerning hosting Silverlight 2.0 controls in a rich client application (WPF/Winforms) ? The last information that I found is that Silverlight is only supported in the web browser (from Zhenlan Wang, 05-08-2007, http://silverlight.net/forums/t/845.aspx) but maybe there is something in the pipeline for the beta release that allows this ?


    As a background : We have an internally developed graph control that we would like to migrate from ActiveX and VB6 to Silverlight 2.0 and C# but we would also like to keep on using it in thin and rich client applications.


    thanks,

    Tuesday, January 15, 2008 5:37 AM

Answers

  • Unfortunately what you’re seeking is not supported. But since you’re using WPF to create the hosting application, can you keep your solution all WPF? WPF provides almost all features Silverlight has. So I think you don’t need to create a separate Silverlight application unless you want cross platform support. But if you need cross platform, you can’t use WPF as the hosting application.

    Thursday, January 17, 2008 3:40 AM

All replies

  • Why not just host the WebBrowser on WPF and WinForms to show the control?  The reality is that Silverlight must live on a web page so hosting it in a WebBrowser is required.  (e.g. Try the Frame class in WPF, or hte WebBrowser control in WinForms).

    Tuesday, January 15, 2008 1:20 PM
  • Hi Shawn,

    A requirement in our situation is that the SL control would also interact with the host application (through properties, methods and events).  I guess it is possible to create a communication channel between the SL control hosted inside a Winforms WebBrowser control and the host application (by using window.external) but that would be a complicated solution.

    I was wondering whether Microsoft would provide a Winforms/WPF ‘SilverlightHost’ control that would make this scenario much simpler.

    Thanks for the feedback,

    Wednesday, January 16, 2008 2:39 AM
  • Unfortunately what you’re seeking is not supported. But since you’re using WPF to create the hosting application, can you keep your solution all WPF? WPF provides almost all features Silverlight has. So I think you don’t need to create a separate Silverlight application unless you want cross platform support. But if you need cross platform, you can’t use WPF as the hosting application.

    Thursday, January 17, 2008 3:40 AM
  • Thanks for the info Yi-Lun !

     

    The reason that we are not building a WPF control is that most of our customers want a thin client application and only some of them want a rich client application. Cross platform support is not so important for us but we want an easy way to interact with the control through JavaScript.  Correct me when I am wrong but I guess that is impossible to expose JavaScript callable methods and events with a WPF control hosted within an XBAP application inside a IFrame ?

     

    So we’ll go for the Silverlight control and we’ll support rich client application by using the WebBrowser control in WinForms (and the Frame class in WPF, currently we don’t have customers yet with WPF) where the host application communicates with the control through window.external. We will have to write some boilerplate code to implement this but it will still be less work than having to write and support a WPF control next to the Silverlight control.

     

    Best greetings,

    Thursday, January 17, 2008 5:17 AM
  • Here's something interesting that popped up last week:

    http://www.liveside.net/blogs/main/archive/2008/02/29/microsoft-launches-new-msn-toolbar-beta-powered-by-silverlight.aspx

     

    Essentially Microsoft is hosting a Silverlight control inside a toolbar. I'm not certain if they're using the WebBrowser ActiveX component to make it work.

     

    Anyway, this got me thinking how it would be possible as well.

    Monday, March 03, 2008 12:23 PM
  • Seems that Microsoft is going to use Silverlight  in their own software. With the MSN toolbar I guess that because the host is Internet Explorer they don’t need the WebBrowser ActiveX control to pull this off...

    Thanks for the info,

    Tuesday, March 04, 2008 11:51 AM