[英]Why does my grid not scroll vertically
即使将包装网格中的方向更改为垂直或水平,网格也不会垂直滚动。 但是,在水平方向上,我的项目是垂直排列的,我可以使滚动条滚动,但是当我使用滚动条时,它不能垂直工作。
<Grid Grid.Row="2" VerticalAlignment="Center" Margin="120,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock FontSize="26" Text="You are assigned to the following wards, please select one to continue:"/>
<GridView Name="WardGridView" ItemsSource="{Binding
Source={StaticResource WardGridViewCollectionViewSource}}"
SelectionMode="None"
IsItemClickEnabled="True" ScrollViewer.VerticalScrollBarVisibility="Auto"
ItemClick="WardGridView_ItemClick" Grid.Row="1" >
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<WrapGrid Margin="0,0,0,10" Orientation="Horizontal"/>
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<GridView.ItemTemplate>
<DataTemplate>
<Grid Width="1000" Height="500" Background="#DBDBDB">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black" FontFamily="Segoe UI" Text="{Binding message}" FontSize="20" />
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
</Grid>
我需要在代码中进行哪些更改才能使项目垂直滚动?
将RowDefinition更改为此:
<!-- Row where the GridView is shown -->
<RowDefinition Height="*" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.