Robbert Dam
Robbert Dam

Reputation: 4107

Cannot load external ResourceDictionary

I'm 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 reflector on the "OfficeStyle" DLL gives:

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

Running the app gives this error:

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

The error pops up and the XAML code I've placed 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.

Upvotes: 0

Views: 1298

Answers (2)

Thomas Levesque
Thomas Levesque

Reputation: 292425

what is the build action for your OfficeStyleWindow.xaml file ? It should be Page, not EmbeddedResource

Upvotes: 1

mdm20
mdm20

Reputation: 4563

Try adding the folder name to the pack path.

pack://application:,,,/OfficeStyle;component/Resources/OfficeStyleWindow.xaml

Upvotes: 0

Related Questions