将BasedOn Style属性引用到动态资源 [英] Referring BasedOn Style property to a dynamic resource

查看:104
本文介绍了将BasedOn Style属性引用到动态资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

专家

我的应用程序中有一个DefaultStyles.xaml资源字典,当应用程序启动时,该字典将作为应用程序合并字典的一部分加载.我也有一个CustomStyles.xaml,它覆盖了DefaultStyles.xaml.

i have a DefaultStyles.xaml resource dictionary in my application, which is loaded as part of application merged dictionaries when application starts. I also have a CustomStyles.xaml which is overriding DefaultStyles.xaml.

我可以基于合并字典中定义的另一种样式来制作样式吗?到目前为止,我只能引用定义为静态资源的样式,在这种情况下,这种功能就没有用了.

Can I make a style (somewhere) BasedOn another style defined in merged dictionaries? Until now i was able to refer only styles defined as static resources and in this case is such feature useless.

感谢您的建议.

推荐答案

我也有同样的问题.诸如此类的东西会导致错误:

需要做这样的事情该怎么办?

在此先感谢,

Rei
I have the same question too. Something like this causes an error:

<Style BasedOn="{DynamicResource buttonStyle}">
   <Background="Green"/>
</Style>

What should we do when we need to do something like this?

Thanks in advance,

Rei


这篇关于将BasedOn Style属性引用到动态资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆