【发布时间】:2014-03-06 07:38:21
【问题描述】:
需要有关 xaml 布局的帮助。
我有一个 Wrappanel,里面有两个元素。左边的 MainGrid 需要固定在 900 像素。第二个,AuxillaryDataScrollViewer,如果 WrapPanel 包裹它,我希望最小为 650,最大为 100%。这可能吗?
这是我目前得到的:
<Window x:Class="scratch.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="768" Width="1024">
<Grid>
<ScrollViewer>
<WrapPanel>
<Grid Width="900" Height="800" Background="Bisque"></Grid>
<ScrollViewer HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Hidden" Width="650">
<Grid Width="1500" Height="700" Background="Tomato"></Grid>
</ScrollViewer>
</WrapPanel>
</ScrollViewer>
</Grid>
</Window>
谢谢!
编辑添加更多细节:
客户希望进行数据输入并在右侧面板中实时查看计算结果,但他实验室中的某些计算机只能具有 1280 像素宽度,因此他希望将结果包装到下方的那些计算机数据输入表单。
【问题讨论】:
-
你想让这两个元素并排吗?
-
如果显示器有分辨率,如果没有,我希望它换行。
-
我测试了您的代码,它按您的预期工作。
-
感谢您查看代码,它并不能完全满足我的需要,因为如果它被包装,它不会拉伸到整个页面宽度。