我有一個StackPanel裏面有幾個CheckBox控件。當窗口大小調整時,如何防止StackPanel收縮並遮住CheckBox控件?如何將StackPanel的MinHeight設置爲其內容的組合高度?
<StackPanel Margin="12,89,12,62" Name="stackPanel1">
<CheckBox Name="chkOption1" Width="157" IsChecked="True" Margin="6">Do this thing</CheckBox>
<CheckBox Name="chkOption2" Width="157" IsChecked="True" Margin="6">Do another thing</CheckBox>
<CheckBox Name="chkOption2" Width="157" Margin="6">Do a third thing</CheckBox>
<Button Height="23" Name="btnRunOperations" Click="btnRunOperations_Click" Margin="3">Do Selected Things</Button>
</StackPanel>
編輯:是否WPF有一個不同的容器控件,有這種行爲「開箱」?這似乎是一個非常常見的情況。