Hi All,
I want to set the text color of textblock text with foreground property.
http://msdn.microsoft.com/en-us/library/system.windows.controls.textblock.foreground(v=vs.100).aspx
So I have following code to set the foreground property
TextBlock
label = new TextBlock() { Style = LabelStyle }; Binding binding = new Binding(LabelColor) { Source = dataContextProperty }; label.SetBinding(TextBlock.ForegroundProperty, binding);
Note that LabelColor is a Brush. If I set,
label.SetBinding(TextBlock.BackgroundProperty, binding)
It worked for background. So why it is not working only for foreground?