1. ScrollViewer:滚动条容器,当内容超过指定的长度和宽度后,就会出现滚动条,而且可以使用鼠标中键来滚动,
简单例子如下:
1 <Window x:Class="ConnectScrollViewScrollingDemo.MainWindow" 2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 4 Title="MainWindow" Height="400" Width="600"> 5 <Grid> 6 <!--the normal control--> 7 <ScrollViewer> 8 <StackPanel> 9 <TextBlock Text="123"></TextBlock> 10 <TextBlock Text="123"></TextBlock> 11 <TextBlock Text="123"></TextBlock> 12 <Label Content="456"/> 13 <Label Content="456"/> 14 <Label Content="456"/> 15 <Label Content="456"/> 16 <UserControl Content="789"/> 17 <UserControl Content="789"/> 18 <UserControl Content="789"/> 19 <UserControl Content="789"/> 20 <UserControl Content="789"/> 21 <Button Content="010"/> 22 <Button Content="010"/> 23 <Button Content="010"/> 24 <Button Content="010"/> 25 <Button Content="010"/> 26 <Rectangle Height="20" Fill="Black"/> 27 <Rectangle Height="20" Fill="Black"/> 28 <Rectangle Height="20" Fill="Black"/> 29 <Rectangle Height="20" Fill="Black"/> 30 <Rectangle Height="20" Fill="Black"/> 31 <Rectangle Height="20" Fill="Black"/> 32 </StackPanel> 33 </ScrollViewer> 34 </Grid> 35 </Window>