2009-04-09 80 views
30

我现在有一个问题,当我的WPF应用程序在垂直窗口太小时隐藏折叠下的任何东西。我如何使用XAML为整个应用程序显示垂直滚动条,以便用户可以滚动查看其余内容?在WPF中启用滚动条

回答

70

将一个ScrollViewer中的窗口内:

<Window x:Class="WpfApplication2.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="Window1" Height="300" Width="300"> 

    <ScrollViewer > 
     <!-- Window content here --> 
    </ScrollViewer> 
</Window>