0
votes

I need to integrate my silverlight application inside a WPF application. For this I'm planning on using the WebBrowser control.

However, I also need to customise the behaviour of the Silverlight application based on a few interfaces implemented by the host WPF application. Given that the host cannot communicate directly with Silverlight, I was thinking of having the host application embedding some WCF services and call those from the Silverlight code.

Has anyone ever done that ?

I'm not too keen on hosting a mini web server in the host app... Fortunately Silverlight 4 supports WCF TCP binding so I'm thinking of heading down this road...

1
I'm curious, why would you want to integrate a Silverlight app into a WPF app in this way? How much effort would be involved in modifing the existing Silverlight code so that it compiles to WPF as well? - AnthonyWJones
That would be another option but as we know there are some inconsistencies between Silverlight and WPF, and also some stuff that exist in Silverlight and not in WPF. I may well end up doing this though if the proposed solution does not work... - Clement

1 Answers

0
votes

While I haven't done it myself I see no reason why it shouldn't work as long as you stick to Silverlight's allowed Port Range for the TCP Endpoint of your service.

What I did implement a while back was a Socket based communication channel between a WPF app and a Silverlight app used to push events from the WPF App to the Silverlight App. This worked quite well. IMO it's a shame that Silverlight's LocalMessageSender/Receiver is only available to Silverlight Applications (and that it is limited to 64kb payloads - but that's a different story).