是否可以在 WinForms 中将 List 绑定到 ListView? [英] Is it possible to bind a List to a ListView in WinForms?

查看:25
本文介绍了是否可以在 WinForms 中将 List 绑定到 ListView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一个 ListView 绑定到一个 List.我正在使用此代码:

I'd like to bind a ListView to a List<string>. I'm using this code:

somelistview.DataBindings.Add ("Items", someclass, "SomeList");

我收到此异常:无法绑定到属性Items",因为它是只读的.

如果 Items 属性是只读的,我不知道应该如何绑定?

I don't know how I should bind if the Items property is readonly?

推荐答案

ListView 类不支持设计时绑定.这个项目中提供了另一种选择.

The ListView class does not support design time binding. An alternative is presented in this project.

这篇关于是否可以在 WinForms 中将 List 绑定到 ListView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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