Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tile an image in the background?

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.

like image 876
Kibnet Philosoff Avatar asked Oct 11 '25 08:10

Kibnet Philosoff


1 Answers

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.

like image 187
Kazgaa Avatar answered Oct 15 '25 05:10

Kazgaa