我有点卡在我的
WPF网格的ScrollViewer上.我使用代码向Grid添加元素,因此XAML中的Grid主体只是空的.我还通过代码添加ColumnDefinitions和RowDefinitions.这是我网格的主体:
<Grid x:Name="grdChampions" HorizontalAlignment="Left" Height="336" Margin="65,60,0" VerticalAlignment="Top" Width="671"> </Grid>
解决方法
您应该在ScrollViewer中嵌入Grid,其属性VerticalScrollBarVisibility和HorizontalScrollBarVisibility设置为Auto
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"> <Grid x:Name="grdChampions" HorizontalAlignment="Left" Height="336" Margin="65,0" VerticalAlignment="Top" Width="671"> </Grid> </ScrollViewer>