How to provide SourceDictionary Source in WPF with folder structure

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

Now, in Wizard.xaml:

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

works great.

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

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

does not work.

Please help me. I am new to WPF.

+4
source share
1 answer

Try AssemblyTitle in your source as shown below:

<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/YourProjectAssemblyTitle;component/Resources/Resources.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
+12
source

Source: https://habr.com/ru/post/1525713/


All Articles