Search code examples
c#wpfxamlgridstretch

My background stretch changes when i open application


My background image changes when i open application

I used this:

<Grid Name ="alo">
        <Grid.Background>
            <ImageBrush ImageSource="D:\Smth\Pics\135.jpg" Stretch="None"/>
        </Grid.Background> 

background before launch

background afterlaunch


Solution

  • The image is shown in its native, unstretched size.

    In order to make it fill the Grid while keeping its aspect ratio, set Stretch to UniformToFill:

    <ImageBrush ImageSource="D:\Smth\Pics\135.jpg" Stretch="UniformToFill"/>