Cannot load external ResourceDictionary

I am trying to load an external XAML file using this code:

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/OfficeStyle;component/OfficeStyleWindow.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

      

Opening the reflector in the "OfficeStyle" DLL gives:

alt text http://robbertdam.nl/share/p3.png

Running the application throws this error:

alt text http://robbertdam.nl/share/p4.png

An error message appears and the XAML I posted at the beginning of this post. What am I missing? The XAML file I'm trying to load contains a bunch of styles, etc. I want to reuse in my application.

0


a source to share


2 answers


what is the build action for your OfficeStyleWindow.xaml file? It should be a page, not an embedded Resource



+1


a source


Try adding the folder name to the package path.



package: // Application: ,, / OfficeStyle; component / Resources / OfficeStyleWindow.xaml

0


a source







All Articles