none
UWP中ListView控件如何添加可用的滚动条? RRS feed

  • 问题

  • <ListView x:Name="lv" Tapped="lv_Tapped" Margin="54,124,35,55" >
                        <!--设置为三列显示列表格式-->
                        <ListView.ItemsPanel>
                            <ItemsPanelTemplate>
                                <WrapGrid Orientation="Vertical" MaximumRowsOrColumns="3" />
                            </ItemsPanelTemplate>
                        </ListView.ItemsPanel>
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <Border BorderThickness="1" BorderBrush="AliceBlue">
                                    <Image Source="{Binding ImgPath}" Width="120" Height="240"/>
                                </Border>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>
    为什么我添加的控件不能用滚动条,显示水平或竖直的滚动条,但是点击滚动时内容没响应,怎么回事?
    2017年7月17日 15:30

答案

  • 您好,

    你需要给ListView启用垂直滚动或者水平滚动:

    <ListView x:Name="lv" Margin="54,124,35,55" ScrollViewer.VerticalScrollMode="Enabled" ScrollViewer.HorizontalScrollMode="Enabled">
    
    ......

    谢谢


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • 已标记为答案 learn WP 2017年8月5日 14:40
    2017年8月1日 7:47

全部回复

  • 您好,

    你需要给ListView启用垂直滚动或者水平滚动:

    <ListView x:Name="lv" Margin="54,124,35,55" ScrollViewer.VerticalScrollMode="Enabled" ScrollViewer.HorizontalScrollMode="Enabled">
    
    ......

    谢谢


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • 已标记为答案 learn WP 2017年8月5日 14:40
    2017年8月1日 7:47
  • 谢谢

    2017年8月5日 14:40