WPF Web Based

WPF Examples

WPF

WPF Projects

WPF Project

adplus-dvertising
ScrollViewer Control In WPF Web Base
Previous Home Next

WPF provides a ScrollViewer control that is a container for other controls and creates a scrollable area. It is simple to create and add to a XAML file. The developer can choose to display a horizontal and/or vertical scroll bar.

For this article, I chose to hide the scoll bar so that the user must scroll by clicking on the content in the 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.

Syntax of ScrollViewer:

<ScrollViewer HorizontalScrollBarVisibility="Visible" >
</ScrollViewer>

Example:

Design Output:

.XAML.CS CODE:

<Page x:Class="WpfBrowserApplication5.Page10"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Page10">
<Grid>
<ScrollViewer HorizontalScrollBarVisibility="Visible" >
<Grid Background="Aqua">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" MinWidth="60" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Label Margin="5" Grid.Column="0" Grid.Row="0">List of Student:
</Label>
<Label Margin="5" Grid.Column="0" Grid.Row="1">Address:</Label>
<Label Margin="5" Grid.Column="0" Grid.Row="2">Comment:</Label>
<RichTextBox Margin="5" Grid.Column="1" Grid.Row="0" MinWidth="100" />
<RichTextBox Margin="5" Grid.Column="1" Grid.Row="1" MinWidth="100" />
<RichTextBox Margin="5" Grid.Column="1" Grid.Row="2" MinWidth="100" />
</Grid>
</ScrollViewer>
</Grid>
</Page>
Previous Home Next
WPF Examples

WPF

WPF

WPF

WPF

WPF

WPF

WPF

WPF