How to tile an image in the background?

518 Views Asked by At

I try to do this, but it doesn't work:

<Border
    HorizontalAlignment="Stretch"
    VerticalAlignment="Stretch">
    <Border.Background>
        <ImageBrush
            AlignmentX="Left"
            AlignmentY="Top"
            Source="/Assets/background.png"
            Stretch="None"
            TileMode="Tile" />
    </Border.Background>
</Border>

It feels like something else needs to be done for TileMode="Tile" to make It work. The markup above just displays one image in the corner of the border and that's it.

1

There are 1 best solutions below

0
Kazgaa On

Try setting DestinationRect. If the image is 32x32 px set DestinationRect="0 0 32 32" and see what happens. Also I don't think you need to set the alignment.