This project has moved. For the latest updates, please go here.

Resource keyname conflict between application resources

Feb 14, 2013 at 6:49 PM
Edited Feb 14, 2013 at 6:51 PM
We have several independent apps that we are trying to tie together as a MEF application. Each of the original apps had common resources declared in App.Xaml. Now with MEF, there are no instances of those apps and consequently, no common resources. That causes the xaml that depended on those StaticResources to fail.

So I added my App's resources through code like this (in Delphi Prism):
   class procedure GlobalResources.LoadResources;

      procedure LoadResource( resourceUri : String );
            rd : ResourceDictionary;
         rd := new ResourceDictionary( Source := new Uri( resourceUri, UriKind.Relative ) );
         Application.Current.Resources.MergedDictionaries.Add( rd );

      LoadResource( '/GuardianEditObservation;component/Assets/ConverterResources.xaml' );
      LoadResource( '/GuardianEditObservation;component/Assets/Styles.xaml' );
      LoadResource( '/GuardianEditObservation;component/Assets/EditObservationViewResources.xaml' );
That made everything work in the MEF application. However, these resources all have to have keys. And some other app might be using the SAME keys.

Isn't this going to be a problem if two app (xaps) contain global resources with the same keys? Is there a way to specify the StaticResource so that it resolves the ambiguities?