您必须设置ScrollViewer的最大高度,并可以将滚动条的可见性设置为自动。
下面是从msdn的例子:
<ScrollViewer Height="200" Width="200" HorizontalScrollBarVisibility="Auto" Canvas.Top="60" Canvas.Left="340">
<TextBlock Width="300" TextWrapping="Wrap"
Text="I am the very model of a modern Major-General, I've information vegetable, animal, and mineral, I know the kings of England, and I quote the fights historical, From Marathon to Waterloo, in order categorical; I'm very well acquainted, too, with matters mathematical, I understand equations, both the simple and quadratical, About binomial theorem I'm teeming with a lot o' news, With many cheerful facts about the square of the hypotenuse." />
</ScrollViewer>
什么是不工作?这段代码对我来说看起来很好。添加一些文字并尝试滚动。 – keyboardP
它不能被滚动 –
尝试给你的ScrollViewer一个高度值。 – keyboardP