MahApps.Metro cannot find resources

c#, mahapps.metro, wpf

Solution

from the wiki

'Colours' -> 'Colors'

Yes, we changed all `Colours` to `Colors` ! The naming of the colors were inconsistent so we decided to change the naming. Also the resource dictionary goes from `Colours.xaml` to `Colors.xaml` .

release notes for 0.11.0

Quick How To

Application

<Application x:Class="WpfApplication.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.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>
</Application>

MainWindow

<controls:MetroWindow x:Class="WpfApplication.MainWindow"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
                      Title="MainWindow"
                      Height="600"
                      Width="800">
  <Grid>
    <!-- now your content -->

  </Grid>
</controls:MetroWindow>

Problem

I am trying to create new WPF application usign MahApps.Metro. I do exactly as described in quick start guide (http://mahapps.com/MahApps.Metro/guides/quick-start.html): - Add MahApps.Metro package from Nuget to the project. - Add xmlns namespace and replaced Window with MetroWindow. At this point I can run the application, but the window is transparent. Title bar text and buttons are visible (and buttons are not styled), but the background is transparent. - Add merged dictionaries code for the Window. After that I receive an exception on startup: ``` System.IOException {"Cannot locate resource 'styles/colours.xaml'."} ``` Seems as for some reason it cannot find resources in the assembly. But I don't understand why.

Original source