在WPF中启用滚动条

res*_*ion 37 wpf xaml wpf-controls

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

Jak*_*sen 80

将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>
Run Code Online (Sandbox Code Playgroud)