如何使图像适合 WPF 窗口的整个背景?就像填满窗户一样

问题描述 投票:0回答:1

所以我尝试拉伸图像,但没有成功。不确定这是否是我想要做的,而且我在网上找不到任何有帮助的东西。

Ive tried this and a few more things but they dont work The image doesnt fill the entire window

c# wpf xaml
1个回答
0
投票

您可以使用 ImageBrush 作为窗口背景:

<Window x:Class="YourProject.MainWindow" ...>
    <Window.Background>
        <ImageBrush ImageSource="chessbackground.jpg"/>
    </Window.Background>
    <Grid>
        ...
    </Grid>
</Window>
© www.soinside.com 2019 - 2024. All rights reserved.