views:

187

answers:

1

Summary:

I want the prettiness of Silverlight/WPF in part of my current Winforms application. The application can only have access to the full .NET Framework 2.0, no more and no less. The only possibility I can think of is a Silverlight OOB application that utilizes Com+ Automation but I can't figure out how to attach the Silverlight application to a panel within the parent Winforms application.

Details:

I currently have a winforms application, and want to take advantage of the improved GUI features in WPF but to many of my users are still running .Net Framework 2.0 and refuse to update to 3+. So WPF is not an option for me.

I know Silverlight is just a subset of WPF, but it has most of the features I'm looking for and only requires the Silverlight plug-in. I've read about Silverlight 4's Com+ Automation, which would give me access to the full desktop .Net Framework 2.0 (which I need). In order for Com+ Automation to work in Silverlight I need elevated trust and the only way I can find to gain elevated trust is to make my Silverlight application Out-Of-Browser (OOB).

My problem is that the OOB application seems to run in its own container window and I need the Silverlight application embedded inside a panel in my Winforms application. My Winforms application does not need to communicate with the Silverlight application and vice-versa, this is purely to have everything contained and displayed in one window.

If there is another way to get my desired result that I have not thought of feel free to suggest it.

+4  A: 

The best option is to host the Silverlight content within a WebBrowser Control. This will allow your Silverlight content to run "inside" your windows forms application.

The COM automation won't help for embedded silverlight INTO a Windows Forms application. It's really intended for using COM from within Silverlight, not the other way around.

Reed Copsey
Communication between the two could then be achieved via javascript and the DOM.
Jeff Yates
I need COM automation to access .NET Framework classes from within Silverlight so I have to create an OOB application. As far as I know there is no way to load an OOB application from the WebBrowser Control.
JohnMcCon
@JohnMcCon: I don't think you can do what you describe. Your best bet is as Reed suggests and then use javascript to achieve communication between Silverlight and the WinForm app.
Jeff Yates
Yes. Unfortunately, silverlight (by design) restricts you here. You can't have both in-browser (which allows for embedded) + reduced restrictions.
Reed Copsey