wpfvisual-studioxamlmaterial-design-in-xamlxaml-resources

WPF application resource locator can't locate a file


I'm very new to .NET C# WPF app making and I've come across this package called MaterialDesignInXaml to stylize my app but I can't get the thing to work. The error comes when I include a certain document in the application resources in the app.xaml.The second and fourth documents in the application resources (that I've commented out here), when included will cause the window to not even render. It just builds and thats it. Like no window pops up nothing

What I don't get is why the first file thats included works but the second file doesn't. Like both files are in the same folder and everything so if the resource locator can find the file above it why can't it find another file in the same directory? Further, I actually checked if both of those files were in the MaterialDesignInXaml Toolkit folder in the required place and they are both actually there. Can someone please explain to me why this is happening? And a way to fix this? Thanx in advance.


Solution

  • So I did my research, and as it turns out, despite the instructions on the official materialDesignInXaml Website, http://materialdesigninxaml.net/, the correct references to add aren't

    <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" />
    

    but rather,

      <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
      <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml" />
      <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
      <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/MaterialDesignColor.Lime.xaml" />
    

    I think the name and the location of the Defaults.xaml and Lime.xaml file changed in some update that happened in the MaterialDesignToolkit github repository in the last month or so. That is the reason even the instructions that are mentioned in the official website didn't even work. These new references work just fine and do the job for now.