我有一个通用Windows平台应用程序。我有一个ScrollViewer,其顶部有一个按钮,一个列表框和ListBox下面的一个按钮(我知道在ScrollViewer中有一个ListBox不是一个好习惯,但这不是我的代码,我不能修改实施)。 ScrollViewer的VerticalScrollMode和VerticalScrollBarVisibility都设置为false,所以不可能垂直滚动(这也是一个要求)。如何修复ScrollViewer/ListBox高度为屏幕高度?
当ListBox包含很多项目时,列表的高度变得比设备高度大。结果列表框下方的一部分和列表下的按钮不可用(因为垂直滚动被禁用)。
<ScrollViewer>
<RelativeLayout>
...
<Button name="Button1">
...
</Button>
<ListBox MinHeight="120">
</ListBox>
<Button name="Button2">
...
</Button>
</RelativeLayout>
</ScrollViewer>
有没有办法将ScrollViewer的高度固定为设备屏幕高度?并修复ListBox的高度,以便ListBox的高度仅增长,以便ListBox适合Button1和Button2之间的空间?