Search code examples
wpfxamlresourcedictionarymahapps.metro

Dictionaries not found when using MahApps.Metro


I just created a new project and got the MahApps.Metro from nuget. I added this to my App.xaml:

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

But I get one error like this for each ResourceDictionary entry:

An error occurred while finding the resource dictionary     "pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml". 

But the dictionaries are found because when I run the application the styles are being applied to the controls. It seems to be a design time only error.

Is there any way to hide them? I'm also having errors for each MahApps Style property that I have set in my XAMLs. Since it's a big application my Error List always has ~30 errors.

This is really annoying, because the styles are being applied when the applicatino run, so there's nothing wrong. When I have a real error it turns in a hell to find it in the middle of all of these other 'erros'


Solution

  • I have the same error if i don't have checked "Run project code in XAML Designer (if supported)". Maybe it is a problem.

    Run project code in XAML Designer (if supported)