Reputation: 37
I have started a blank, new .NET framework 4.8.0 WPF project, and am trying to add Material Design for XAML Toolkit into it. I started by following the quick start guide located on the Github wiki. I installed the nuget packages manually, by using the .nupkg files located here. I get to the first second step of adding the libraries, boom, error.
Could not load file or assembly 'MaterialDesignThemes.Wpf, Culture=neutral' or one of its dependencies. The system cannot find the file specified."
I have looked for hours on how to solve this issue to no avail. Any ideas?
My app.xaml:
<Application x:Class="Launcher.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Launcher"
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>
</Application>
Everything else is as-is since starting the new project.
Thanks :)
Upvotes: 1
Views: 3263
Reputation: 37
Turns out, this from the tutorial works.
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
The first two dictionaries produce errors, but still compile and the errors go away after compilation. I have no clue why.
Upvotes: 1