0
我在UWP中创建了这个GridView,它显示我想要的,但为了滚动它,我需要点击它之前,然后滚动。当使用触摸界面时,我需要点击一下,然后滚动。而且,当选择一个项目时,我需要点击/点击两次。UWP GridView滚动直到点击
有什么办法可以避免这种需要选择然后滚动?
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="Title" Margin="0,0,0,20" Style="{ThemeResource SubheaderTextBlockStyle}" Grid.Row="0"></TextBlock>
<GridView x:Name="ReportsGridView" ItemsSource="{x:Bind Reports, Mode=OneWay}" Grid.Row="1"
ScrollViewer.VerticalScrollMode="Disabled" ScrollViewer.HorizontalScrollMode="Auto" ScrollViewer.HorizontalScrollBarVisibility="Hidden" >
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid Orientation="Vertical" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<GridView.ItemTemplate>
<DataTemplate x:DataType="data:Report">
...
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
</Grid>
我已经尝试过编程设置焦点:
ReportsGridView.Focus(FocusState.Programmatic);
你为什么要操纵ScrollViewer属性? – Jessica
@Jessica使其水平滚动而不显示滚动条。 (请参阅:https://stackoverflow.com/questions/34476647/single-row-horizontally-scrolling-swipeable-gridview) –
如果你没有改变任何东西,它是否按预期工作? – Jessica