具有水平项目的ListView [英] ListView with horizontal items

查看:51
本文介绍了具有水平项目的ListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我来自WPF,我不知道是否有可能使ListView能够水平分布项目,以及鼠标滚轮滚动(鼠标设备)和滑动(触摸设备)之类的所有其他功能.

I come from WPF and I don't know if it's possible to make a ListView to distribute items horizontally, with all the extras like mouse-wheel scrolling (mouse devices) and swiping (touch devices).

我已经尝试过了,但是它的行为不像垂直的.例子:我不能用鼠标滚轮滚动.

I've tried this, but it doesn't behave like the vertical one. Example: I cannot scroll with the mouse-wheel.

<ListView ScrollViewer.VerticalScrollBarVisibility="Disabled"  ScrollViewer.HorizontalScrollBarVisibility="Auto" ItemsSource="{Binding Collection}" >
    <ListView.ItemsPanel>
        <ItemsPanelTemplate>
            <StackPanel Orientation="Horizontal"></StackPanel>
        </ItemsPanelTemplate>
    </ListView.ItemsPanel>
</ListView>

推荐答案

好的,我找到了一种使之工作的方法!

OK, I found a way to make it work!

这就是我所拥有的.我不知道配置是否正确,建议?

This is what I have. I don't know if it's configured fine, suggestions?

<ListView ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Auto"
    ScrollViewer.HorizontalScrollMode="Enabled"                  
    ScrollViewer.VerticalScrollMode="Disabled"
    ItemsSource="{Binding Collection}">
    <ListView.ItemsPanel>
        <ItemsPanelTemplate>
            <StackPanel Background="Transparent" Orientation="Horizontal" />
        </ItemsPanelTemplate>
    </ListView.ItemsPanel>
</ListView>

这篇关于具有水平项目的ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆