XAML Toolkit项目的材料设计设置问题



我已经开始了一个空白的、新的。NET框架4.8.0 WPF项目,并试图将XAML Toolkit的材料设计添加到其中。我首先遵循Github wiki上的快速入门指南。我使用这里的.nupkg文件手动安装了nuget包。我开始了添加库的第一步和第二步,boom,error。

无法加载文件或程序集的MaterialDesignThemes。Wpf,Culture=neutral’或其依赖项之一。系统找不到指定的文件">

关于如何解决这个问题,我找了好几个小时都没有找到。有什么想法吗?

我的应用程序.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>

自从开始新项目以来,其他一切都是原样。

谢谢:(

事实证明,教程中的这一点很有效。

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

前两本词典会产生错误,但仍然会编译,编译后错误就会消失。我不知道为什么。

最新更新