How can the background color on a TextBlock control be changed?
Ah...right...a child control inherits some of the visual attributes of the parent. So, I can put the TextBlock in one of the panels such as a Canvas or ItemsPanel and set the background on the panel. Sure is humongous overhead just to set the background of a control.
TextBlock derives from FrameworkElement and there is no background property for FrameworkElement. So there is no background property for the Textblock class.
Generally, we will provide the background effect with an additional element looks like a container for the TextBlock. For example, we could use Border or Grid like @macintoshpro mentioned in his reply.
If you are using border, it looks like this:
<Border Background="Red"> <TextBlock/> </Border>
10 people are following this question.