资源字典空刷
我试图为我希望能够在之间切换的 wpf 应用程序“皮肤”资源字典。我希望能够将多个用户控件的背景属性设置为一个键,该键在一个字典中为 Solidcolorbrush,在另一个字典中为 null。
如何使资源值为空?以下似乎不起作用。
<SolidColorBrush x:Key="ticketBodyBG">{x:Null}</SolidColorBrush>
有没有办法做到这一点,或者我应该使用透明的画笔键?
I am trying to have to "skin" resource dictionaries for a wpf application that I would like to be able to switch between. I want to be able to set the background property of several user controls to a key that is a solidcolorbrush in one dictionary and null in the other.
How do I make a resource value that is null? The following doesn't seem to work.
<SolidColorBrush x:Key="ticketBodyBG">{x:Null}</SolidColorBrush>
Is there a way to do this, or should I just use a transparent brush key?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不能设置为 null 值,只需将
Brush
留空,它就会自动设置为Transparent
,如下所示 -You can't set to null value, simply left the
Brush
empty, it will automatically will set toTransparent
like this -Try:
相当于空背景(但与透明不同,即:
UIElement
不会响应命中测试)Try:
It is equivalent to a null background (but is different from transparent i.e: the
UIElement
will not respond to hit testing)