以编程方式创建 ListView 项的绑定
我将以下 wpf 控件添加到 xaml 中:
<ListView Margin="22,80,271,12" Name="listView1" ItemsSource="{Binding}" />
我知道如何以编程方式创建 ListView 对象。我唯一缺少的是如何将
ItemsSource="{Binding}"
带有代码的属性添加到该对象。我已经设法用 C# 添加列和 gridview 。我唯一缺少的是添加该属性 ItemsSource="{Binding}"
我尝试寻找答案 这里。
I have the following wpf control added to xaml:
<ListView Margin="22,80,271,12" Name="listView1" ItemsSource="{Binding}" />
I know how to create a ListView object programmatically. The only thing that I am missing is how could I add the property
ItemsSource="{Binding}"
with code to that object. I have already managed to add the columns and gridview with c#. The only thing that I am missing is to add that property ItemsSource="{Binding}"
I have tried looking for an answer here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
最短的应该是这样(XAML的直译):
Shortest should be this (literal translation of XAML):
这是您要找的吗?
Is this what you are looking for?
您需要做的就是:
All you need to do is this: