How to change the background color of a Textblock in Silverlight? -


I need a text block that has a blue text on the yellow background, I use the blue color with the "foreground" I can set the text of. But "background" does not work (I think it is so easy).

So what's the best way to do this, wrap it in a rectangular or canvas whose background color is?

And, anything that we should know about Silverlight, why do not they include background attributes for those elements on which you want to set the background color?

Like this error returns "property background not found in text block":

   Is derived from  

that is derived from the framework element. Controlled

The WPF has its own self.

The best way to add a color behind your text is to place a text such as a border or grid inside a container, something like this:

  & lt; Grid Background = "Yellow" & gt; & Lt; TextBlock foreground = "blue" height = "20" horizontal align = "statch" margin = "0" text = "this is an exam" /> & Lt; / Grid & gt;  

Comments