我正在尝试为平板电脑设计UWP应用程序,我使用的其中一个元素是ListView。当我在ListView中使用鼠标滚动时,它可以正常工作,但如果我试图在触摸屏上滚动,ListView会自动快速回到默认位置。我该如何解决这个问题?
<ListView x:Name="PlayerListBox" HorizontalAlignment="Left" Grid.Column="0" VerticalAlignment="Top" Width="404" ScrollViewer.VerticalScrollBarVisibility="Hidden" Height="620" Margin="-3,0,0,0">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="FontSize" Value="24"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Selected">
<Storyboard>
<ColorAnimation Duration="0" To="#0078D7" Storyboard.TargetProperty="(ListViewItem.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="Content1" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid>
<TextBlock x:Name="listItem1" TextWrapping="WrapWholeWords" />
<ContentPresenter x:Name="Content1" />
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListView.ItemContainerStyle>
</ListView>