如何结合儿童控制的自动调整和拉伸?

时间:2013-07-23 09:51:44

标签: wpf

我需要实现以下场景:

首先,自动调整父控件(窗口)以适合其内容 但是,如果“宽度”或“高度”超过某个值,则会关闭自动调整大小模式,然后在手动调整大小时使用子控件拉伸以占用可用空间。

考虑Grid内的Window

<Window>
     <Grid>
         <Grid.RowDefinitions>
             <RowDefinition Height="Auto"/>
             <RowDefinition Height="Auto" />
             <RowDefinition Height="Auto"/>
         <Grid.RowDefinitions>
     </Grid>
</Window>

这里我需要中间一行自适应改变&#34; Auto&#34;到&#34; *&#34;。
是否可能没有太大的魔力?

1 个答案:

答案 0 :(得分:0)

尝试设置Window.MaxHeightWindow.MaxWidth属性,而不设置任何Window.HeightWindow.Width属性。