Image Background in a TextBlock

Here is the scenario: On my MainPage I have three TextBlocks:

In TextBlock 2 I want to have an Image Background. The problem is that a TextBlock does not have a Background property. What I have to do is to add the TextBlock to a layout control and set its Background property. There are different ways to do this:

1. Add the TextBlock to a Grid and set the Background property of the Grid:

2. In this case you might need to apply additional Margins:

3. The (in my opinion) easiest approach is to put a Border around the TextBlock:

Which approach you take is a matter of personal taste. The result is the same:


To be continued…


  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: