在 WPF 中启用滚动条
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/736153/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Enabling Scrollbar in WPF
提问by resopollution
I'm having a problem right now where my WPF application hides anything below the fold when the window is too small vertically. How can I use XAML to get a vertical scrollbar to appear for the entire app so the user can scroll to see the rest of the content?
我现在遇到了一个问题,当窗口在垂直方向上太小时,我的 WPF 应用程序隐藏了折叠下方的任何内容。如何使用 XAML 为整个应用程序显示垂直滚动条,以便用户可以滚动查看其余内容?
回答by Jakob Christensen
Put a ScrollViewer inside your Window:
将 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>