在 WPF ContentView 上设置背景颜色 [英] Setting background color on a WPF ContentView
本文介绍了在 WPF ContentView 上设置背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
似乎在自定义 ContentControl 上设置背景颜色无效.如果我将 ContentControl 更改为 UserControl 背景颜色属性工作正常,
It seems like setting the background color on a custom ContentControl has no effect. If I change the ContentControl to UserControl background color property works fine,
是否有更改内容控件背景的解决方法?
Is there a workaround to change the background of a content control?
推荐答案
对于自定义控件,Background
需要 绑定 在 Template
,否则不使用.
For custom controls the Background
needs to bound in the Template
, otherwise it is not used.
这篇关于在 WPF ContentView 上设置背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文