WPF绑定不适用于TextBlock中的前景属性

时间:2014-07-16 17:14:56

标签: c# wpf xaml textblock

我有以下代码来设置前景属性

TextBlock label = new TextBlock() { Style = LabelStyle }; Binding binding = new Binding(LabelColor) { Source = dataContextProperty }; label.SetBinding(TextBlock.ForegroundProperty, binding);

请注意,LabelColor是一个画笔。 如果我设置,

label.SetBinding(TextBlock.BackgroundProperty, binding)

有效。那么为什么它不仅仅适用于前景?

0 个答案:

没有答案
相关问题