WinRT Xaml ListView - Touch doesn't scroll well

喜夏-厌秋 提交于 2019-12-05 00:51:06

问题


I have a horizontal list view that scrolls offscreen to the right, such as this:

The problem is, when using touch you can't swipe to scroll the ListView by default, it seems to just grab the ListView item and pull it horizontally a little bit. The only way I can get it to scroll is to click the 5-10 pixels in between each ListViewItem, which is horrible.

Is there a setting to modify this behavior?

My Xaml is basically this:

            <ListView 
                x:Name="listView" Grid.Column="1" IsItemClickEnabled="True"
                ItemsSource="{Binding Assignments}" SelectionMode="None" ItemClick="OnItemClick">
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal" />
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
                <ListView.ItemTemplate>
                    <DataTemplate>
                       <!--cool template to make UI in screenshot-->
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

Should I ask Jerry?


回答1:


Hmm, it was due to having a parent ScrollViewer outside of the ListView, I have a large "panorama" with 4 or 5 controls within it, including the ListView.

I able to fix it by setting this on the ListView:

ScrollViewer.HorizontalScrollMode="Disabled" ScrollViewer.VerticalScrollMode="Disabled"



来源:https://stackoverflow.com/questions/13128001/winrt-xaml-listview-touch-doesnt-scroll-well

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!