大佬教程收集整理的这篇文章主要介绍了Silverlight 4 – 在另一个ResourceDictionary中使用StaticResource,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
Dict1.xaml:
<颜色x:键=“颜色1”>红色< /颜色>
Dict2.xaml:
< SolidColorBrush x:Key =“Brush1”Color = {Staticresource Color1} />
这有效:
App.xaml中:
<MergedDictionaries> <resourceDictionary source="Dict1.xaml"/> <MergedDictionaries>
SomePage.xaml:
<UserControl.resources> <MergedDictionaries> <resourceDictionary source="Dict2.xaml"/> </MergedDictionaries> </UserControl.resources>
这不是:
App.xaml在应用程序级别合并.
为什么是这样 ? /它有办法解决吗?我知道这个例子很简单,但真正的例子太长了.基本上我只是想在不同的文件中组织我的样式和模板:
编辑:奇怪的是,如果我在Application_Startup上的代码中执行此操作,在设置rootVisual属性之前,我没有收到错误…我只是为什么感到困惑!
App.xaml中:
<resourceDictionary.MergedDictionaries> <resourceDictionary source="Dict2.xaml" /> <resourceDictionary.MergedDictionaries>
Dict2.xaml:
<resourceDictionary> <resourceDictionary.MergedDictionaries> <resourceDictionary source="Dict1.xaml" /> </resourceDictionary.MergedDictionaries> .... <!-- Dict2 resource --> </resourceDictionary>
以上是大佬教程为你收集整理的Silverlight 4 – 在另一个ResourceDictionary中使用StaticResource全部内容,希望文章能够帮你解决Silverlight 4 – 在另一个ResourceDictionary中使用StaticResource所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。