gpt4 book ai didi

windows-8 - 在 WinRT 中选择 XAML 的 ListView 和 GridView

转载 作者:行者123 更新时间:2023-12-03 11:08:07 26 4
gpt4 key购买 nike

XAML 中的 GridView 和 ListView 似乎是同一个控件。

开发者如何在两者之间做出选择?

最佳答案

GridView 控件通常水平滚动。此外,您将看到项目之间的一些原生间距大于 ListView 中的间距。之所以存在这种间距,是因为旨在考虑如何在 Windows 应用商店应用程序中使用这些控件。 (继续阅读)

  • 与 ListView 一样,它继承自 ItemsControl。
  • 就像使用 GroupStyle 的 ListView 组一样。
  • 与 ListView 一样,它支持两种新的虚拟化策略。
  • 与 ListView 一样,它支持不同的选择模式。

  • 示例语法:
    <GridView>
    <x:String>Item 1</x:String>
    <x:String>Item 2</x:String>
    </GridView>

    ListView 控件通常垂直滚动。

    示例语法:
    <ListView>
    <x:String>Item 1</x:String>
    <x:String>Item 2</x:String>
    </ListView>

    这就是答案

    两者之间的一般区别在于它们在 View 中的出现。 GridView 倾向于出现在 FullView、FillView 和 Portait 中。 ListView 由于其垂直方向,往往会出现在 SnapView 中。任一控件都可以出现在任一 View 中,但这是两个控件的局部转移。

    enter image description here

    MSDN: The ListView and GridView controls are both used to display collections of data in your app. They have similar functionality, but display data differently. They are both derived from the ItemsControl class. When we talk about an ItemsControl, the info applies to both the ListView and GridView controls.

    The ListView displays data stacked vertically. It's often used to show an ordered list of items, such as a list of emails or search results. It's also useful in master-detail scenarios, where the list items contain only a small amount of info and the details of the selected item are shown separately.

    The GridView displays data stacked horizontally. It's often used when you need to show a rich visualization of each item that takes more space, such as a photo gallery.*

    关于windows-8 - 在 WinRT 中选择 XAML 的 ListView 和 GridView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10903669/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com