首页 新闻 会员 周边 捐助

ScrollViewer不显示

0
[待解决问题]

使用ScrollViewer时,发现如果包含在Grid里,可以显示出滚动条;

但是放到StackPanel里,为什么就显示不了?

 

1.放在StackPanel中

 

<StackPanel>
<ScrollViewer Margin="0" VerticalScrollBarVisibility="Auto">
<StackPanel Margin="0">
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
</StackPanel>
</ScrollViewer>
</StackPanel>

 

2.放在Grid中

<Grid>
<ScrollViewer Margin="0" VerticalScrollBarVisibility="Auto">
<StackPanel Margin="0">
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
</StackPanel>
</ScrollViewer>
</Grid>

J.Annan的主页 J.Annan | 菜鸟二级 | 园豆:202
提问于:2018-05-31 11:11
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册