我有两个关于窗户尺寸的问题。基本布局如下
<Window MaxHeight="{DynamicResource {x:Static SystemParameters.VirtualScreenHeight}}"
MaxWidth="{DynamicResource {x:Static SystemParameters.VirtualScreenWidth}}"
>
<StackPanel>
<DockPanel LastChildFill="False">
<StackPanel DockPanel.Dock="Left"
Orientation="Horizontal">
<!--Some buttons-->
</StackPanel>
<StackPanel DockPanel.Dock="Right"
Orientation="Horizontal">
<!--Some buttons-->
</StackPanel>
</DockPanel>
<ScrollViewer>
<WrapPanel x:Name="Container">
</WrapPanel>
</ScrollViewer>
</StackPanel>
</Window>
1) 如何使窗口在水平方向上不小于DockPanel的宽度?
2) 如何将ScrollViewer限制在窗口的限制范围内?它正在根据内容调整自己的大小,延伸到窗口的边界之外。
当我有
<Window><ScrollViewer/></Window>
,但我真的不想把DockPanel放在卷轴里。在当前形式中,它甚至迫使窗口打破其最大高度。