简体   繁体   English

WPF-列表视图。 如何使我的内容垂直和水平显示?

[英]WPF- List View. How can I enable my content to display Vertically and Horizontally?

I'd really appreciate some help in regards to this.在这方面,我真的很感激一些帮助。 So I have a List View on my Home page and at the moment all the content is displayed Vertically.所以我的主页上有一个列表视图,目前所有内容都是垂直显示的。 One underneath the other.一个在另一个下面。 The content is comprised of an Icon, Title and Description.内容由图标、标题和说明组成。 This content is loaded dynamically at run time.此内容在运行时动态加载。 I would like the content to be displayed in a different way so that I have it displayed like我希望内容以不同的方式显示,以便我将其显示为

Content Content内容内容

Content Content内容内容

Content Content内容内容

Content Content内容内容

I am unable to change from a listview so any help would be greatly appreciated.我无法从列表视图中更改,因此将不胜感激任何帮助。 I have been able to have the content display horizontally but not both horizontally and vertically.我已经能够水平显示内容,但不能水平和垂直显示。

Use a UniformGrid with two columns:使用具有两列的 UniformGrid:

    <ItemsControl ItemsSource="{Binding YourCollection}">
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <UniformGrid Columns="2"/>
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
    </ItemsControl>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM