首页 > 解决方案 > 自动将内容大小调整为窗口大小

问题描述

我希望当我更改窗口大小时,我的内容将按照默认大小放置,只有它自己调整大小

<Window =Height="500"
Width="800"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">

<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
    <TextBlock 
         HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
        Name="consoleOutput" 
        Margin="170,10,10,140" 

        Background="Aqua"/>
    <TextBlock 
         HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
        Name="menuOutput" 
        Margin="10,10,630,245" 
        Background="Gray"/>
    <TextBlock 
         HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
        Name="menuOutput2" 
        Margin="10,245,630,10" 
        Background="Green"/>
    <TextBox 
         HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
        Name="consoleInput" 
        Margin="170,340,10,10"  
        Background="Red"
        AcceptsReturn="True"/>
</Grid>
</Window>

标签: c#wpfxamlautoresize

解决方案


推荐阅读