我试图将垂直滚动添加到我的GridView / AdaptiveGridView中,但是到目前为止没有成功(水平滚动有效)。
我已经尝试过使用带有ScrollViewer .---的内部scrollviewer,但在GridView中没有运气。
我也尝试过将ScrollViewer放置在GridView之外,但是没有运气。
XAML
<ScrollViewer
HorizontalScrollBarVisibility="Disabled"
HorizontalScrollMode="Disabled"
VerticalScrollBarVisibility="Auto"
VerticalScrollMode="Auto">
<Grid Name="ChangeMe">
<controls:AdaptiveGridView
Name="MyPolls"
Margin="0,10,0,0"
DesiredWidth="320"
IsItemClickEnabled="True"
ItemClick="MyPolls_ItemClick"
ItemHeight="180"
ItemsSource="{x:Bind oc}"
SizeChanged="MyPolls_SizeChanged">
<controls:AdaptiveGridView.ItemTemplate>
<DataTemplate x:DataType="local:Poll">
<Grid ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollMode="Auto">
<Image Source="../Assets/Square44x44Logo.png" Stretch="UniformToFill" />
<StackPanel
Height="60"
Padding="12"
VerticalAlignment="Bottom"
Background="{ThemeResource SystemBaseLowColor}"
Orientation="Horizontal">
<StackPanel>
<TextBlock Text="{x:Bind poll_title}" />
<TextBlock
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"
Style="{ThemeResource CaptionTextBlockStyle}"
Text="{Binding poll_description}" />
</StackPanel>
</StackPanel>
</Grid>
</DataTemplate>
</controls:AdaptiveGridView.ItemTemplate>
</controls:AdaptiveGridView>
</Grid>
</ScrollViewer>
隐藏代码
private void MyPolls_SizeChanged(object sender, Windows.UI.Xaml.SizeChangedEventArgs e)
{
ChangeMe.Height = MyPolls.Height;
ChangeMe.Width = MyPolls.Width;
}
有人知道一种方法来为GridView / AdaptiveGridView启用垂直滚动,以便当gridview项超出框架时可以向下滚动并查看它们吗? (AdaptiveGridView继承自GridView)