加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

xaml – WrapGrid水平滚动Windows 8

发布时间:2020-12-14 04:38:23 所属栏目:Windows 来源:网络整理
导读:主网格有下一个XAML: ListView Grid.Row="1" x:Name="NewsListBox" ListView.Background SolidColorBrush Color="#FF006C67" Opacity="0.5"/ /ListView.Background ListView.ItemsPanel ItemsPanelTemplate WrapGrid Orientation="Vertical"/ /ItemsPanelTe
主网格有下一个XAML:

<ListView Grid.Row="1" x:Name="NewsListBox">
            <ListView.Background>
                <SolidColorBrush Color="#FF006C67" Opacity="0.5"/>
            </ListView.Background>
            <ListView.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapGrid Orientation="Vertical"/>
                </ItemsPanelTemplate>
            </ListView.ItemsPanel>
        </ListView>

它看起来不错,它是如何需要的:

但它不会滚动内容!

好的,我添加了ScrollViewer:

<ScrollViewer Grid.Row="1" VerticalScrollMode="Disabled" ZoomMode="Disabled">
        <ListView Grid.Row="1" x:Name="NewsListBox">
            <ListView.Background>
                <SolidColorBrush Color="#FF006C67" Opacity="0.5"/>
            </ListView.Background>
            <ListView.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapGrid Orientation="Vertical"/>
                </ItemsPanelTemplate>
            </ListView.ItemsPanel>
        </ListView>
        </ScrollViewer>

并且它垂直堆叠所有内容:

我究竟做错了什么?

解决方法

找到了解决方案.不需要ScrollViewer.

只需用GridView替换ListView,因为ListView不是为水平滚动而设计的.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读