111,098
社区成员




public Window1()
{
InitializeComponent();
scrollViewer1.ScrollToVerticalOffset(70);
}
<Grid x:Name="LayoutRoot" Background="White">
<ScrollViewer Height="100" HorizontalAlignment="Left" Margin="10,10,0,0" Name="scrollViewer1" VerticalAlignment="Top" Width="200">
<StackPanel Height="200" Width="300" Background="Green">
<TextBlock Text="hello"></TextBlock>
<TextBlock Text="hello"></TextBlock>
<TextBlock Text="hellohellohellohellohellohellohellohellohello"></TextBlock>
<TextBlock Text="hello"></TextBlock>
<TextBlock Text="hello"></TextBlock>
<TextBlock Text="hello"></TextBlock>
</StackPanel>
</ScrollViewer>
</Grid>
<Grid Grid.Row="1" x:Name="grid1">
<Grid.RowDefinitions>
<RowDefinition Height="20" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Image Height="20" HorizontalAlignment="Left" Margin="1,1,0,0" Name="ImgLegend" Stretch="Fill" VerticalAlignment="Top" Width="373" Source="Image/图例.png" Grid.RowSpan="2" />
<Canvas Name="canva" Grid.Row="1" SizeChanged="canva_SizeChanged">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" x:Name="sv">
<Rectangle Width="4000" Height="4000" />
</ScrollViewer>
</Canvas>
</Grid>
private void canva_SizeChanged(object sender, SizeChangedEventArgs e)
{
sv.Width = e.NewSize.Width;
sv.Height = e.NewSize.Height;
}