简体   繁体   中英

C# WPF - Unable to find resource dictionary

I'm trying to use a theme for my WPF application called Monotone , but I'm having a problem with it. I followed their instructions in the How to use section, but I'm getting an error that says, "An error occurred while finding the resource dictionary "Monotone.Colors.xaml":

错误

Although I have all required files in my application folder:

夹

Can you help me?

In the documentation, I see it says "just need to add to app.xaml". That isn't quite right and maybe that's your problem.

You need to add the resource dictionaries to your project. Check you have added them to your project. If not them right click project choose add existing and find the files.

If you already did then check what the properties are. Select one in solution explorer and look in the property window ( usually just under Solution explorer ). You should have Build Action: Page and Copy to output directory: Do not copy. These settings compile them into your exe.

You can actually load uncompiled resource dictionaries but they would have to be in the bin/Debug folder next to your compiled exe.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM