C# WPF Material DesignThemes 5.0 命名规则改变后导致找不到资源

复制代码
	MaterialDesignInXAML库从5.0.0版本开始的命名规则变化,使用新的ResourceDictionary时遇到的themes/materialdesigntheme.defaults.xaml找不到.

原本在App.xaml中定义如下:

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

自5.0.0版本更新后,命名方式改变,两条引用找不到。

复制代码
	Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml"

Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml"

这两条改为:

复制代码
	Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml"

	Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Secondary/MaterialDesignColor.Lime.xaml"

最终整个Application.ResourcessourceDictionary>

复制代码
  <ResourceDictionary.MergedDictionaries>

    <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/Recommended/Secondary/MaterialDesignColor.Lime.xaml" />

  </ResourceDictionary.MergedDictionaries>

</ResourceDictionary>

</Application.Resources>

相关推荐
三次拒绝王俊凯18 分钟前
java求职学习day47
java·开发语言·学习
合作小小程序员小小店18 分钟前
基于可视化天气系统demo,基于python+ matplotlib+request爬虫,开发语言python,数据库无,10个可视化界面,需要的可以了联系。
开发语言·爬虫·python·matplotlib
宝桥南山39 分钟前
.NET10 - 尝试一下Blazor Web Assembly Standalone App的fingerprint新特性
microsoft·微软·c#·asp.net·.net·.netcore
一匹电信狗1 小时前
【牛客CM11】链表分割
c语言·开发语言·数据结构·c++·算法·leetcode·stl
2501_938963961 小时前
解析 Lua 虚拟机整数与浮解析 Lua 虚拟机整数与浮点数处理:类型转换与运算精度控制
开发语言·lua
不染尘.1 小时前
图的邻接矩阵实现以及遍历
开发语言·数据结构·vscode·算法·深度优先
国服第二切图仔1 小时前
Rust开发之Trait作为参数与返回值使用
开发语言·后端·rust
山峰哥1 小时前
KingbaseES 表空间与模式优化策略深度研究报告
开发语言·数据结构·数据库·oracle·深度优先
yong99901 小时前
C++语法—类的声明和定义
开发语言·c++·算法
狂奔的sherry1 小时前
构造/析构/赋值运算理解
开发语言·c++