MainPage.xaml
<Page
x:Class="UniversalAppTutorials.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UniversalAppTutorials"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
>
<ScrollViewer
x:Name="ScrollViewer1"
Background="FloralWhite"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto"
>
<StackPanel Orientation="Vertical" Padding="50">
<Button
x:Name="Button1"
Content="Scroll To Bottom"
Click="Button1_Click"
/>
<TextBlock Text="A" FontSize="150"/>
<TextBlock Text="B" FontSize="150"/>
<TextBlock Text="C" FontSize="150"/>
<TextBlock Text="D" FontSize="150"/>
<TextBlock Text="E" FontSize="150"/>
<TextBlock Text="F" FontSize="150"/>
<TextBlock Text="G" FontSize="150"/>
<TextBlock Text="H" FontSize="150"/>
<TextBlock Text="I" FontSize="150"/>
<TextBlock Text="J" FontSize="150"/>
<TextBlock Text="K" FontSize="150"/>
<TextBlock Text="L" FontSize="150"/>
<TextBlock Text="M" FontSize="150"/>
<TextBlock Text="N" FontSize="150"/>
<TextBlock Text="O" FontSize="150"/>
<TextBlock Text="P" FontSize="150"/>
<TextBlock Text="Q" FontSize="150"/>
<TextBlock Text="R" FontSize="150"/>
<TextBlock Text="S" FontSize="150"/>
<TextBlock Text="T" FontSize="150"/>
<TextBlock Text="U" FontSize="150"/>
<TextBlock Text="V" FontSize="150"/>
<TextBlock Text="W" FontSize="150"/>
<TextBlock Text="X" FontSize="150"/>
<TextBlock Text="Y" FontSize="150"/>
<TextBlock Text="Z" FontSize="150"/>
</StackPanel>
</ScrollViewer>
</Page>
MainPage.xaml.cs
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml;
namespace UniversalAppTutorials
{
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
private void Button1_Click(object sender, RoutedEventArgs e)
{
/*
UIElement.UpdateLayout
Ensures that all positions of child objects of
a UIElement are properly updated for layout.
*/
ScrollViewer1.UpdateLayout();
/*
ScrollViewer.ChangeView
Causes the ScrollViewer to load a new view into
the viewport using the specified offsets and zoom factor.
*/
// Programmatically scroll to bottom
ScrollViewer1.ChangeView(
0.0f, // horizontalOffset
double.MaxValue, // verticalOffset
1.0f // zoomFactor
);
// Another way to programmatically scroll to bottom
// But above way is better
//ScrollViewer1.ScrollToVerticalOffset(ScrollViewer1.ScrollableHeight);
}
}
}


- UWP - ComboBox ItemTemplate example
- UWP - Drawing on a Canvas example
- UWP - Canvas example
- UWP - ScrollViewer example
- UWP - How to launch app in full screen mode
- UWP - How to set app launch window size
- UWP - How to set app window minimum size
- UWP - How to change title bar text
- UWP - How to change title bar color
- UWP - Segoe MDL2 Assets programmatically
- UWP - Viewbox stretch example
- UWP - Viewbox example
- UWP - How to resize SymbolIcon
- UWP - How to underline text in a TextBlock
- UWP - How to change TextBlock background color