Enabling Scrollbar in WPF

resopollution picture resopollution · Apr 10, 2009 · Viewed 48.1k times · Source

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?

Answer

Jakob Christensen picture Jakob Christensen · Apr 10, 2009

Put a ScrollViewer inside your Window:

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