MahApps / MahApps.Metro

A framework that allows developers to cobble together a better UI for their own WPF applications with minimal effort.
https://mahapps.com
MIT License
9.28k stars 2.45k forks source link

Visual Studio 2015 - XAML errors for all Metro* resources #2801

Closed MrCroix closed 7 years ago

MrCroix commented 7 years ago

I'm not certain of the precipitating cause of my errors. I've been using MahApps Metro for about a year without any issues but very suddenly, possibly after upgrading from 1.2.x to 1.4.1, I see XAML errors stating "The resource "[metro resource here]" could not be resolved.".

My googling this suggests the following:

Ensure the App.xaml contains the metro merged dictionaries correctly. Check. (file attached)

Delete the ComponentModelCache. Check, no effect. Do a "Repair Install" of Visual Studio. Check, no effect. Reinstall MahApps.Metro from GitHub. Check. no effect. Reboot. Check (numerous), no effect.

Running the program and everything works flawlessly, the Visual Studio designer does not display correctly and shows errors for all references to Metro resources. See screenshot.

This is driving me CRAZY!!

app vsmetroerrors

Expected outcome

There shouldn't be resource errors. Once corrected, the designer will display correctly.

--

Environment

punker76 commented 7 years ago

@MrCroix VS is sometimes... nah, ok, try these steps

  1. override MahApps styles after original styles
  2. clear the VS shadow cache C:\Users\<USER>\AppData\Local\Microsoft\VisualStudio\14.0\Designer\ShadowCache
  3. cleab obj/bin folders
  4. build all and look if it's now working
MrCroix commented 7 years ago

Can you tell me what you mean by "override MahAps styles after original styles".

And

Yes, I know this isn't MahApps metros fault but it is still a problem.

MrCroix commented 7 years ago

I tried everything else, no effect, still broken.

MrCroix commented 7 years ago

Oh, and, thank you.

punker76 commented 7 years ago

@MrCroix Sorry about this nasty issue with your VS.

Can you tell me what you mean by "override MahAps styles after original styles".

In your screen first screenshot you change TextBox style inheirted from MahApps MetroTextBox. This should be done after defining the resources from MahApps, not before.

I tried everything else, no effect, still broken.

Do you cleared the shadowcache? Also check your references if they correct with the dlls in the output.

Sorry, I don't know what's going wrong on your machine... (do you have VS 2015 Update 3?)...

MrCroix commented 7 years ago

Moving the one MetroTextBox reference above or below the resource declarations makes no difference. Must be a two pass compile.

Yes, Visual Studio 2015 Update 3.

Still have the errors.

dovegq commented 4 years ago

Same in Visual Studio 2019, but VS2015 is OK

margy82 commented 4 years ago

Same here. Last update VS2019 Community. Mahapps 1.6.5, Controlz 3.0.2.4 Full of error in designer preview, compilation and run ok.