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