WPF异常:在“System.Windows.Markup.StaticResourceHolder”上提供值时引发了异常。
2016-04-22 16:27
351 查看
异常背景:
第一次开发 WPF 时,所有资源都定义在 App.xaml 文件中。随着项目资源的增多,查看与修改资源时很麻烦,就在 App.xaml 以集成资源字典的方式。
异常原因:
在 App.xaml 中定义资源时,我把项目中需要使用的 Class 都写在最上面
资源字典 - 其它
因为 Class 资源声明在后,而其它资源声明(该资源中有对 Class 资源的引用 )在前,所以报错。
第一次开发 WPF 时,所有资源都定义在 App.xaml 文件中。随着项目资源的增多,查看与修改资源时很麻烦,就在 App.xaml 以集成资源字典的方式。
异常原因:
在 App.xaml 中定义资源时,我把项目中需要使用的 Class 都写在最上面
<ResourceDictionary xmlns:app ="clr-namespace:TZCloud" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> ... </ResourceDictionary>
资源字典 - 其它
<Application.Resources> <ResourceDictionary > <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Dictionary\Other.xaml"/> <ResourceDictionary Source="Dictionary\Class.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources>
因为 Class 资源声明在后,而其它资源声明(该资源中有对 Class 资源的引用 )在前,所以报错。
相关文章推荐
- CoreData的一些简单运用
- 你的孤独,虽败犹荣 摘抄
- 欢迎使用CSDN-markdown编辑器
- Java重载时的类型转换
- 【bzoj2002】[Hnoi2010]Bounce 弹飞绵羊
- Coco2d-x-2.x和3.x创建工程以及编译安卓注意事项
- 关于spring发email总结
- 利用Handler来实现UI线程的更新
- 括号配对(南阳理工2)栈
- 在Word中如何自动生成参考文献引用
- BP神经网络的网络带宽预测
- django/python日志logging 的配置以及处理
- 华为交换机板卡端口型号对照
- 快吧游戏盒官方下载2016 v4.0.5.6959 官方最新版
- 数据持久化,一个简单的hibernate例子
- Java权限管理之Spring Security
- opencv:累加图像求平均(c语言版本)
- php统计文件夹所有文件 及 容量大小
- BZOJ2391: Cirno的忧郁
- C++第四次作业