Create ScrollViewer in WPF with VB.NET

In this article you will learn how to create ScrollViewer in WPF.
  • 1686
ScrollViewer: In WPF scrolling or you can say the ScrollViewer is used when we want to fit the large amounts of content in a limited amount of space. The ScrollViewer control provides a convenient way to enable scrolling of content in WPF. ScrollViewer encapsulated the ScrollBars within it and displays it whenever it is required. As the ScrollViewer implements IScrollInfo is the main scrolling area inside the scrollviewer. ScrollViewer also responds to mouse and keyboard commands.

Example of ScrollViewer

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
    <ScrollViewer>
        <StackPanel>
            <Label>Which color you want</Label>
            <Button>Red</Button>
            <Button>Blue</Button>
            <Button>Pink</Button>
            <Button>Green</Button>
            <Button>Black</Button>
            <Button>Pink</Button>
            <Button>Pink</Button>
            <Button>Pink</Button>
            <Button>Pink</Button>
            <Button>Pink</Button>
            <Button>Pink</Button>
            <Button>Pink</Button>
            <Button>Pink</Button>
            <Button>Pink</Button>
            <Button>Pink</Button>
            <Button>Pink</Button>
            <Button>Pink</Button>
            <Button>Pink</Button>
            <Button>Pink</Button>
        </StackPanel>        
   
</ScrollViewer>
</Window>

Output window

scroll.gif 

Conclusion


Hope this article helps you to learn ScrollViewer in WPF.

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.