在WPF中居中TabControl的背景

时间:2021-06-02 23:59:22

I'm trying to get an image to float unstreched in the middle of my TabControl. I started with the below XAML which stretches the image.

我正试图让我的TabControl中间的图像浮动。我开始使用下面的XAML来拉伸图像。

<TabControl>
    <TabControl.Background>
        <ImageBrush  ImageSource="/LogoTest;component/logo_final.png" />            
    </TabControl.Background>
</TabControl>

I've tried various approaches like using a VisualBrush with a Grid inside it but I can't get the desired result.

我尝试过各种各样的方法,例如在其中使用带有网格的VisualBrush但我无法获得所需的结果。

Is there a simple way of doing this that I'm missing?

有没有一种简单的方法可以解决这个问题?

1 个解决方案

#1


1  

<ImageBrush 
    ImageSource="/LogoTest;component/logo_final.png" 
    AlignmentX="Center" AlignmentY="Center" 
    Stretch="None"/>

#1


1  

<ImageBrush 
    ImageSource="/LogoTest;component/logo_final.png" 
    AlignmentX="Center" AlignmentY="Center" 
    Stretch="None"/>