tags:

views:

234

answers:

1

I have the below block of XAML

'BaseStyles.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="ShinyBlue.xaml"/>
        <ResourceDictionary Source="DataGrid.Generic.xaml"/>
    </ResourceDictionary.MergedDictionaries>

</ResourceDictionary>

Forms that reference this work in design-time, but not in run time. If my form references ShinyBlue.xaml or DataGrid.Generic.xaml directly, that style sheet works.

EDIT

If I paste this directly into the form, it works correctly. Appearently the problem somehow has to do with my wrapper.

Broken

<Window.Resources>
    <ResourceDictionary Source="../BaseStyles.xaml"/>
</Window.Resources>

Works

<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="ShinyBlue.xaml"/>
    <ResourceDictionary Source="DataGrid.Generic.xaml"/>
</ResourceDictionary.MergedDictionaries>
+2  A: 

Try including your whole path from namespace to filename:

<ResourceDictionary Source="pack://application:,,,/[YourDll];component/[YourLocation]/ShinyBlue.xaml"/>

Where [YourDll] is the name of your project, and [YourLocation] is the location where the ResourceDictionary resides in your dll.

Arcturus