1

Subject line pretty much describes my question.

Can I embed one Silverlight app into another one and make them communicate with each other (like pass parameters back and forth?)

Masha
  • 327
  • 1
  • 6
  • 17

3 Answers3

1

Any Silverlight project compiles down to a DLL, and a Silverlight DLL can load other Silverlight DLLs. So essentially, yes, you can reference another Silverlight application by treating it as a library. This will allow you to instantiate its classes, call methods on those classes, and so forth. That's not quite the same thing you're asking, but it's pretty close, and it would probably allow you to do what you need to do.

One thing to be aware of is that there's only one Application.Current, and so the only App.xaml that gets loaded is the very first one. If you have resources defined in your contained application's app.xaml, you'll need to redefine those resources in the containing application's app.xaml.

Ken Smith
  • 20,305
  • 15
  • 100
  • 147
  • I was thinking about it, and I manages to load a .xap file dynamically and even pass some parameters to my control, but can a control from a dynamically loaded .xap communicate to the main application? Do you know if it's possible at all? – Masha Feb 11 '11 at 21:32
0

Like Ken said, not possible in the pure sense of an application within an application.

My question to you is why? Perhaps that might help us to understand what you are doing and better answer how to do what you want to do.

As you can communicate between two Silverlight Apps running in the same client. Look up "LocalMessageSender" and "LocalMessageReceiver" under System.Windows.Messaging.

mle_ii
  • 468
  • 3
  • 6
  • Why is a good question and I'm not sure I understand it 100% myself, I was just ask to do the research. I did find System.Windows.Messaging, but thank you for the reference anyway! From what I understand, it's supposed to work something like a desktop - there's a main application and additional apps are supposed to be loaded upon some menu click. – Masha Feb 09 '11 at 14:55
0

Ended up using MEF for this purpose.

Masha
  • 327
  • 1
  • 6
  • 17