views:

59

answers:

1

I have a need to host a Silverlight application as a module in an existing WinForms application. My plan is to host the web page that hosts the Silverlight app in a web browser control in the WinForms application.

The part I have not been able to figure out is how to communicate from the Silverlight application back to the Winforms application. For starters, the Silverlight application needs to inform the web page that it is closing and have the browser control inform the WinForms module that the application has terminated. Once that is working I need to be able to send several different events to the WinForms program.

This does not seems like it should be hard to do, but I am hoping that someone can save me a lot of experimenting and keep me from wasting time following the wrong path.

My environment is Silverlight 4. The Winforms application also currently is hosting some WPF controls.

A: 

kind of a backwards approach.

Silverlight is a workaround to make WPF available on other platforms.

If you are running winforms, just host it as WPF window. It is really easy.

MyWindow window = new MyWindow(); // WPF widnow
ElementHost.EnableModelessKeyboardInterop(window) // this is part of windforms integration namespace, allows winforms and wpf to communicate
window.Show();
Sonic Soul