Kenny
Kenny

Reputation: 849

Tiling (repeating) image on Windows Phone 7.5 background

I need to repeat or tile a single image (size 9x9) across the Windows Phone 7.5 background.

How can this be done? I haven't found anything using Bing.

Upvotes: 0

Views: 1569

Answers (1)

Heinrich Ulbricht
Heinrich Ulbricht

Reputation: 10372

In WPF you normally would do it with a tiled Grid.Background as described here. But in WP7 this unfortunately is not possible. So the only ways of achieving this are writing something yourself or using a component.

One component is presented in this blog post. It is basically a panel filling itself with the same image over and over again. At the end of the article there is a download link. Download the zip, unzip it and add TilePanel.cs to your project.

Then you can use it as follows in your XAML:

<local:TilePanel x:Name="pnlTile" TileWidth="62" TileHeight="62">
    <local:TilePanel.Image>
        <ImageBrush ImageSource="ApplicationIcon.png" />
    </local:TilePanel.Image>
</local:TilePanel>

Don't forget to add the namespace:

xmlns:local="clr-namespace:WiredPrairie.Controls"

The panel will be filled with the image specified in your XAML. Adjust image and size as needed.

Upvotes: 4

Related Questions