Search code examples
wpfxamlexceptionresourcedictionary

How Can i address theme in other solution in wpf


I have a project with several solutions. In my core solution, i have a theme folder that contains my themes. In shell solution and App.xaml file I wanna to address my themes. like this:

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/Hezareh.Core;component/Themes/CustomDocumentViewerTemplate.xaml" />
            <ResourceDictionary Source="/Hezareh.Core;component/Themes/Darkness.xaml" />
            <ResourceDictionary Source="/Hezareh.Core;component/Themes/Generic.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

But i receive this error :

Set property 'System.Windows.ResourceDictionary.Source' threw an exception.


Solution

  • myself find a solution for this problem.

    for solve this problem we should right click on theme file and click properties.

    on properties window most set Build action to page.