How to give ResourceDictionary Source in WPF with folder structure

17,374

Try AssemblyTitle in your source like below:

<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/YourProjectAssemblyTitle;component/Resources/Resources.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
Share:
17,374
Jeevan
Author by

Jeevan

Updated on July 22, 2022

Comments

  • Jeevan
    Jeevan almost 2 years

    In a WPF application, Resources.xaml(Resource Dictionary) is placed in Resources folder and GetStarted.xaml(UserCOntrol) is placed in Views folder. Wizard.xaml(UserControl) is in the root folder.

    Now, in Wizard.xaml:

    <ResourceDictionary.MergedDictionaries>
        <ResousrceDictionary Source="Resources/Resources.xaml"></ResourceDictionary>
    </ResourceDictionary.MergedDictionaries>
    

    works fine.

    I'm not sure how to access it In GetStarted.xaml,

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="component/Resources/Resources.xaml"></ResourceDictionary>
    </ResourceDictionary.MergedDictionaries>
    

    doesn't work.

    Please help me. I'm new to WPF.