本文介绍了动态构建列表视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个listview,我想在运行时动态构建它,因为我想使用同一个窗口显示包含不同字段的两个不同列表。



我该怎么做呢?



I have this listview and I would like to build it dynamically at runtime as I would like to use the same window to display two different lists containing different fields.

How do I go about doing this?

<ListView.View>
    <GridView>
        <GridViewColumn Width="140"  DisplayMemberBinding="{Binding GameName}">
            <GridViewColumnHeader Tag="GameName" Click="lvUsersColumnHeader_Click">GameName</GridViewColumnHeader>
        </GridViewColumn>
        <GridViewColumn Width="140"  DisplayMemberBinding="{Binding Creator}">
            <GridViewColumnHeader Tag="Creator" Click="lvUsersColumnHeader_Click">Creator</GridViewColumnHeader>
        </GridViewColumn>
        <GridViewColumn Width="140"  DisplayMemberBinding="{Binding Publisher}">
            <GridViewColumnHeader Tag="Publisher" Click="lvUsersColumnHeader_Click">Publisher</GridViewColumnHeader>
        </GridViewColumn>
    </GridView>
</ListView.View>

推荐答案


这篇关于动态构建列表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 14:54