1

I have four Silverlight 4 apps, for which I'm trying to build a "shell" to host them in, dynamically loading the Xaps on demand, and giving the user the impression they are a single application.

Each application currently has its own App.xaml, which defines a System.Windows.Application. My question is - if my outer shell app defines an App.xaml, then can the Xap files it loads also define one? Or must there only be one App.xaml across all the constituent apps?

Mike Chamberlain
  • 39,692
  • 27
  • 110
  • 158

1 Answers1

1

The other assemblies can define their own App.xaml files, but they won't be executed or referenced. In my testing, the only App.xaml that gets used/executed is the one that's defined by the first (container) application. Any reference after that to App.Current will return that particular instance.

Ken Smith
  • 20,305
  • 15
  • 100
  • 147
  • Interesting... my constituent apps each load various styles into the Application resource dictionary. So, now only my master app.xaml runs, how do I load my various resource dictionaries? Perhaps programatically instead of declaratively? – Mike Chamberlain Feb 01 '11 at 06:50
  • 1
    The way that I've been doing it is to "re-" load them all in the master application. I don't really like it, since it violates DRY, but I haven't figured out a better way. It might be possible to use generic.xaml for this (see http://stackoverflow.com/questions/689044/using-mergeddictionaries-in-generic-xaml-in-silverlight-3), but I haven't been able to get that working yet. Perhaps I'm just doing something wrong :-). – Ken Smith Feb 01 '11 at 16:07