您必須設置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