Search code examples
wpfxamlmaterial-design

MaterialDesignXAMLToolkit setup not working


I'm trying to setup MaterialDesignXAMLToolkit and I follow the steps but it still does not work. I do not have much experience with WPF and XAML.

This is my App.xaml:

<Application x:Class="MaterialDesign_TEST.App"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
         StartupUri="MainWindow.xaml">
<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <materialDesign:BundledTheme BaseTheme="Light" PrimaryColor="DeepPurple" SecondaryColor="Lime" />
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

I have installed the MaterialDesignThemes NuGet and also ShowMeTheXAML as they require in the Getting started guide but it shows me that the Source cannot be found.

enter image description here

Did I missed something?


Solution

  • Try replacing:

    <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
    

    With:

    <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
    

    I had the same problem with the Toolkit and after replacing that line everything started working for me.

    Also, double check none of the packages have a yellow warning triangle in the list under Dependencies>Packages.

    enter image description here