Cannot find resource dictionary in WPF application

I had the same issue, but setting Build Action = Page did not solve for me. Turned out I needed to use the Pack URI Format. So,

<ResourceDictionary Source="pack://application:,,,/Styles/MetroTheme.xaml"/>

EDIT

Turns out the above will eliminate build error but still results in runtime error. I needed to include full assembly specification for complete resolution (even though all files are in same assembly):

<ResourceDictionary Source="pack://application:,,,/WpfApplication10;component/Styles/MetroTheme.xaml"/>

Make sure that the build action for MetroTheme.xaml is set to Page.

enter image description here

Tags:

C#

Wpf

Xaml