如何绑定List< string>到ItemsControl? [英] How do I bind a List<string> to an ItemsControl?

查看:97
本文介绍了如何绑定List< string>到ItemsControl?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在演示者中,我具有以下属性:

In my presenter I have this property:

public List<string> PropertyNames { get; set; }

我想用ItemsItem/DataTemplate列出这些名称:

And I want to list out the names with a ItemsControl/DataTemplate like this:

<ItemsControl ItemsSource="{Binding PropertyNames}">
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Value}"/>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

由于通用列表没有命名属性,如何在Binding语句中引用?

Since the generic list doesn't have named properties, how do I reference the value in my Binding statement?

推荐答案

让我回答一下,它只是{Binding}.

let me answer this, it's just {Binding}.

这篇关于如何绑定List&lt; string&gt;到ItemsControl?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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