如何在 Viewbox 中拉伸 Grid

How to stretch Grid within a Viewbox

我想在 Viewbox 内拉伸 Grid。我有上帝的代码不能正常工作。有什么线索吗?

 <Viewbox HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
         <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
            </Grid.RowDefinitions>
 </Grid>
</Viewbox>

你想要 ViewBox property Stretch 这个。

将 Viewbox 的拉伸 属性 更改为填充,如下所示。

<视框拉伸="Fill">