在WPF中启用滚动条

时间:2009-04-09 22:49:56

标签: wpf xaml wpf-controls

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

1 个答案:

答案 0 :(得分:78)

将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>