I watched a Tim Heuer movie to dynamically load another XAP (into the Silverlight Silverlight application), as well as some other links to configure resource loading, and I had a specific problem with loading style resources from within dynamically loaded XAP (i.e. the contents of Assets \ Styles.xaml). When I start the master hosting, it successfully transfers dynamic XAP, and I can read the deployment information, etc. And load the components of the assembly. However, when I try to instantiate a form from Dynamic XAP, it fails with
Cannot find resource with name / key LayoutRootGridStyle
which is in it Assets \ Styles.xaml file (it works if I run it directly so that I know it in order). For some reason, they do not appear as application resources - are not sure if I completely got the wrong end of the stick or just missed something? Below is a snippet of code (I apologize that it is a little messy - just trying to get it to work in the first place) ...
''
Just to overlap, there are 3 scenarios to consider ... 1) Dynamically loaded XAP style resources remain in the combined resource dictionary (in a separate xaml file), which is referenced by the app.xaml application of the dynamically loaded Silverlight (XAP) application. When the main application starts, resources from dynamic XAP are apparently not present in the current application (after loading the XAP assembly components). An error has occurred.
2) Dynamically loaded XAP style resources are transferred from the integrated resource dictionary (from a separate xaml file) to the app.xaml of the dynamic application instead of a link to the integrated resource directory. - When starting the main application, resources from the dynamic XAP DO are apparently present in the current application (after loading parts of the XAP assembly). However, the error is still happening.
3) Dynamically loaded XAP-style resources are copied to the call / master application app.xaml (undesirable). - The error no longer occurs.
source share