如何使此代码可滚动? 我尝试过这个解决方案,但它不起作用:Need to scroll one WPF Grid 我的XAML(名为Photos的网格必须滚动):
<Grid Height="533" VerticalAlignment="Bottom">
<TextBox x:Name="siteAdressTextBox" HorizontalAlignment="Left" Height="23" Margin="10,10,0,0" TextWrapping="Wrap" Text="http://www.etrapez.pl/" VerticalAlignment="Top" Width="215"/>
<Button x:Name="sendWebRequestButton" Content="Wyślij zapytanie" HorizontalAlignment="Left" Margin="10,38,0,0" VerticalAlignment="Top" Width="107" Click="webRequest"/>
<Button Content="Pobierz wszystko" HorizontalAlignment="Left" Margin="122,38,0,0" VerticalAlignment="Top" Width="103" Click="downThemAll"/>
<ScrollViewer HorizontalAlignment="Left" Height="460" Margin="10,63,0,0" VerticalAlignment="Top" Width="1000" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Visible" CanContentScroll="True">
<Grid x:Name="Photos" HorizontalAlignment="Left" Height="460" VerticalAlignment="Top" Width="1000" ShowGridLines="False" ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Visible" />
</ScrollViewer>
<TextBox Name="InfoBoxLabel" IsReadOnly="True" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Left" Height="48" Margin="230,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="300"/>
</Grid>
答案 0 :(得分:0)
试试这个
<Grid Height="533" VerticalAlignment="Bottom">
<TextBox x:Name="siteAdressTextBox" HorizontalAlignment="Left" Height="23" Margin="10,10,0,0" TextWrapping="Wrap" Text="http://www.etrapez.pl/" VerticalAlignment="Top" Width="215"/>
<Button x:Name="sendWebRequestButton" Content="Wyślij zapytanie" HorizontalAlignment="Left" Margin="10,38,0,0" VerticalAlignment="Top" Width="107"/>
<Button Content="Pobierz wszystko" HorizontalAlignment="Left" Margin="122,38,0,0" VerticalAlignment="Top" Width="103" />
<ScrollViewer HorizontalAlignment="Left" Height="460" Margin="10,63,0,0" VerticalAlignment="Top" Width="1000" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Visible">
<Grid x:Name="Photos" ShowGridLines="False">
<TextBlock TextWrapping="Wrap" Text="text here"/>
</Grid>
</ScrollViewer>
<TextBox Name="InfoBoxLabel" IsReadOnly="True" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Left" Height="48" Margin="230,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="300"/>
</Grid>