13

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.

1 Answer 1

30

Try AssemblyTitle in your source like below:

<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/YourProjectAssemblyTitle;component/Resources/Resources.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
1
  • The /YourProjectAssemblyTitle;component part is optional. Source="/Resources/Resources.xaml" will work just as well.
    – Scover
    Jun 3, 2023 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.