我已經開始了一個空白的新 .NET 框架 4.8.0 WPF 專案,并且正在嘗試將 Material Design for XAML Toolkit 添加到其中。我首先按照Github wiki 上的快速入門指南進行操作。我使用位于此處的 .nupkg 檔案手動安裝了 nuget 包。我進入添加庫的第一步,繁榮,錯誤。
無法加載檔案或程式集“MaterialDesignThemes.Wpf,Culture=neutral”或其依賴項之一。該系統找不到指定的檔案。”
我已經尋找了幾個小時來解決這個問題,但無濟于事。有任何想法嗎?
我的 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>
自從開始新專案以來,其他一切都保持原樣。
謝謝 :)
uj5u.com熱心網友回復:
事實證明,教程中的這個是有效的。
<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>
前兩個字典產生錯誤,但仍然編譯,編譯后錯誤消失。我不知道為什么。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/422340.html
標籤:
